You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dubbo.apache.org by wa...@apache.org on 2018/10/15 13:35:48 UTC
[incubator-dubbo] branch master updated: Optimize ut for
serialization model. (#2632)
This is an automated email from the ASF dual-hosted git repository.
wangxin pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-dubbo.git
The following commit(s) were added to refs/heads/master by this push:
new 1ef1220 Optimize ut for serialization model. (#2632)
1ef1220 is described below
commit 1ef12208df62c7f23e13b0bd024955ea9f552f43
Author: 时无两丶 <44...@qq.com>
AuthorDate: Mon Oct 15 21:35:36 2018 +0800
Optimize ut for serialization model. (#2632)
* 1. Integrate the unit test of the serialization module, code reuse.
2. Remove redundant unit tests and pojo classes.
3. Remove the useless pojo class in the common module.
* fix ci fail
* fix ci fail
* fix ci fail
* fix ci fail
* remove author info
---
.../org/apache/dubbo/common/model/AnimalEnum.java | 21 -
.../apache/dubbo/common/model/BizException.java | 29 -
.../model/BizExceptionNoDefaultConstructor.java | 26 -
.../dubbo/common/model/media/MediaContent.java | 78 --
.../common/serialize/fastjson/model/Image.java | 104 --
.../common/serialize/fastjson/model/Person.java | 38 -
.../src/test/resources/log4j.xml | 32 -
.../common/serialize/fst/model/AnimalEnum.java | 21 -
.../common/serialize/fst/model/FullAddress.java | 199 ----
.../src/test/resources/log4j.xml | 32 -
.../org/apache/dubbo/common/model/AnimalEnum.java | 21 -
.../model/BizExceptionNoDefaultConstructor.java | 26 -
.../dubbo/common/model/SerializablePerson.java | 97 --
.../dubbo/common/model/media/MediaContent.java | 78 --
.../dubbo/common/model/person/PersonStatus.java | 22 -
.../apache/dubbo/common/model/person/Phone.java | 139 ---
.../AbstractSerializationPersonFailTest.java | 137 ---
.../src/test/resources/log4j.xml | 32 -
.../dubbo/common/serialize/dubbo/SimpleDO.fc | 2 -
.../org/apache/dubbo/common/model/AnimalEnum.java | 21 -
.../apache/dubbo/common/model/BizException.java | 29 -
.../java/org/apache/dubbo/common/model/Person.java | 95 --
.../dubbo/common/model/SerializablePerson.java | 97 --
.../org/apache/dubbo/common/model/media/Image.java | 120 --
.../org/apache/dubbo/common/model/media/Media.java | 205 ----
.../dubbo/common/model/person/BigPerson.java | 151 ---
.../dubbo/common/model/person/FullAddress.java | 202 ----
.../dubbo/common/model/person/PersonInfo.java | 206 ----
.../dubbo/common/model/person/PersonStatus.java | 22 -
.../apache/dubbo/common/model/person/Phone.java | 139 ---
.../AbstractSerializationPersonOkTest.java | 93 --
.../serialization/AbstractSerializationTest.java | 1210 -------------------
.../src/test/resources/log4j.xml | 32 -
.../dubbo/common/serialize/dubbo/SimpleDO.fc | 2 -
.../apache/dubbo/common/model/BizException.java | 29 -
.../model/BizExceptionNoDefaultConstructor.java | 26 -
.../java/org/apache/dubbo/common/model/Person.java | 95 --
.../org/apache/dubbo/common/model/media/Image.java | 120 --
.../org/apache/dubbo/common/model/media/Media.java | 205 ----
.../dubbo/common/model/media/MediaContent.java | 78 --
.../dubbo/common/model/person/BigPerson.java | 151 ---
.../dubbo/common/model/person/FullAddress.java | 202 ----
.../dubbo/common/model/person/PersonInfo.java | 206 ----
.../AbstractSerializationPersonFailTest.java | 137 ---
.../AbstractSerializationPersonOkTest.java | 93 --
.../serialization/AbstractSerializationTest.java | 1215 --------------------
.../src/test/resources/log4j.xml | 32 -
.../dubbo-serialization-test/pom.xml | 68 ++
.../base}/AbstractSerializationPersonFailTest.java | 23 +-
.../base}/AbstractSerializationPersonOkTest.java | 39 +-
.../serialize/base}/AbstractSerializationTest.java | 50 +-
.../fastjson/FastJsonObjectInputTest.java | 2 +-
.../fastjson/FastJsonObjectOutputTest.java | 6 +-
.../fastjson/FastJsonSerializationTest.java | 3 -
.../dubbo/common/serialize/fst/FstFactoryTest.java | 0
.../common/serialize/fst/FstObjectInputTest.java | 5 +-
.../common/serialize/fst/FstObjectOutputTest.java | 6 +-
.../common/serialize/fst/FstSerializationTest.java | 0
.../serialize/hessian2/Hessian2PersonOkTest.java} | 17 +-
.../hessian2}/Hessian2SerializationTest.java | 5 +-
.../jdk}/CompactedJavaSerializationTest.java | 3 +-
.../serialize/jdk}/JavaSerializationTest.java | 3 +-
.../common/serialize/jdk/JdkPersonOkTest.java} | 12 +-
.../jdk}/NativeJavaSerializationTest.java | 3 +-
.../common/serialize/kryo/KryoPersonOkTest.java} | 11 +-
.../serialize/kryo}/KyroSerializationTest.java | 4 +-
.../serialize/kryo}/ReflectionUtilsTest.java | 3 +-
.../dubbo/common/serialize}/model/AnimalEnum.java | 2 +-
.../common/serialize}/model/BizException.java | 2 +-
.../model/BizExceptionNoDefaultConstructor.java | 2 +-
.../dubbo/common/serialize}/model/Person.java | 2 +-
.../serialize}/model/SerializablePerson.java | 2 +-
.../dubbo/common/serialize}/model/media/Image.java | 2 +-
.../dubbo/common/serialize}/model/media/Media.java | 2 +-
.../serialize}/model/media/MediaContent.java | 2 +-
.../common/serialize}/model/person/BigPerson.java | 2 +-
.../serialize}/model/person/FullAddress.java | 2 +-
.../common/serialize}/model/person/PersonInfo.java | 2 +-
.../serialize}/model/person/PersonStatus.java | 2 +-
.../common/serialize}/model/person/Phone.java | 2 +-
.../support/SerializableClassRegistryTest.java | 13 +-
.../src/test/resources/log4j.xml | 30 +
.../SimpleDO.fc | 0
dubbo-serialization/pom.xml | 3 +-
84 files changed, 219 insertions(+), 6463 deletions(-)
diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/model/AnimalEnum.java b/dubbo-common/src/test/java/org/apache/dubbo/common/model/AnimalEnum.java
deleted file mode 100644
index ddfc736..0000000
--- a/dubbo-common/src/test/java/org/apache/dubbo/common/model/AnimalEnum.java
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.dubbo.common.model;
-
-public enum AnimalEnum {
- dog, cat, rat, cow, bull, horse;
-}
\ No newline at end of file
diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/model/BizException.java b/dubbo-common/src/test/java/org/apache/dubbo/common/model/BizException.java
deleted file mode 100644
index 51fd04b..0000000
--- a/dubbo-common/src/test/java/org/apache/dubbo/common/model/BizException.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.dubbo.common.model;
-
-public class BizException extends RuntimeException {
-
- private static final long serialVersionUID = 1L;
-
- public BizException(String message) {
- super(message);
- }
-
- public BizException() {
- }
-}
\ No newline at end of file
diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/model/BizExceptionNoDefaultConstructor.java b/dubbo-common/src/test/java/org/apache/dubbo/common/model/BizExceptionNoDefaultConstructor.java
deleted file mode 100644
index c3346ca..0000000
--- a/dubbo-common/src/test/java/org/apache/dubbo/common/model/BizExceptionNoDefaultConstructor.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.dubbo.common.model;
-
-public class BizExceptionNoDefaultConstructor extends RuntimeException {
-
- private static final long serialVersionUID = 1L;
-
- public BizExceptionNoDefaultConstructor(String message) {
- super(message);
- }
-}
\ No newline at end of file
diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/model/media/MediaContent.java b/dubbo-common/src/test/java/org/apache/dubbo/common/model/media/MediaContent.java
deleted file mode 100644
index 7991f50..0000000
--- a/dubbo-common/src/test/java/org/apache/dubbo/common/model/media/MediaContent.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.dubbo.common.model.media;
-
-import java.util.List;
-
-@SuppressWarnings("serial")
-public class MediaContent implements java.io.Serializable {
- public Media media;
- public List<Image> images;
-
- public MediaContent() {
- }
-
- public MediaContent(Media media, List<Image> images) {
- this.media = media;
- this.images = images;
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o) return true;
- if (o == null || getClass() != o.getClass()) return false;
-
- MediaContent that = (MediaContent) o;
-
- if (images != null ? !images.equals(that.images) : that.images != null) return false;
- if (media != null ? !media.equals(that.media) : that.media != null) return false;
-
- return true;
- }
-
- @Override
- public int hashCode() {
- int result = media != null ? media.hashCode() : 0;
- result = 31 * result + (images != null ? images.hashCode() : 0);
- return result;
- }
-
- public String toString() {
- StringBuilder sb = new StringBuilder();
- sb.append("[MediaContent: ");
- sb.append("media=").append(media);
- sb.append(", images=").append(images);
- sb.append("]");
- return sb.toString();
- }
-
- public Media getMedia() {
- return media;
- }
-
- public void setMedia(Media media) {
- this.media = media;
- }
-
- public List<Image> getImages() {
- return images;
- }
-
- public void setImages(List<Image> images) {
- this.images = images;
- }
-}
\ No newline at end of file
diff --git a/dubbo-serialization/dubbo-serialization-fastjson/src/test/java/org/apache/dubbo/common/serialize/fastjson/model/Image.java b/dubbo-serialization/dubbo-serialization-fastjson/src/test/java/org/apache/dubbo/common/serialize/fastjson/model/Image.java
deleted file mode 100644
index bb2dc06..0000000
--- a/dubbo-serialization/dubbo-serialization-fastjson/src/test/java/org/apache/dubbo/common/serialize/fastjson/model/Image.java
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.dubbo.common.serialize.fastjson.model;
-
-public class Image implements java.io.Serializable {
- private static final long serialVersionUID = 1L;
- private String uri;
- private String title;
- private int width;
- private int height;
- private Size size;
-
- public Image(String uri, String title, int width, int height, Size size) {
- this.height = height;
- this.title = title;
- this.uri = uri;
- this.width = width;
- this.size = size;
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o) return true;
- if (o == null || getClass() != o.getClass()) return false;
-
- Image image = (Image) o;
-
- if (height != image.height) return false;
- if (width != image.width) return false;
- if (size != image.size) return false;
- if (title != null ? !title.equals(image.title) : image.title != null) return false;
- if (uri != null ? !uri.equals(image.uri) : image.uri != null) return false;
-
- return true;
- }
-
- @Override
- public int hashCode() {
- int result = uri != null ? uri.hashCode() : 0;
- result = 31 * result + (title != null ? title.hashCode() : 0);
- result = 31 * result + width;
- result = 31 * result + height;
- result = 31 * result + (size != null ? size.hashCode() : 0);
- return result;
- }
-
- public String getUri() {
- return uri;
- }
-
- public void setUri(String uri) {
- this.uri = uri;
- }
-
- public String getTitle() {
- return title;
- }
-
- public void setTitle(String title) {
- this.title = title;
- }
-
- public int getWidth() {
- return width;
- }
-
- public void setWidth(int width) {
- this.width = width;
- }
-
- public int getHeight() {
- return height;
- }
-
- public void setHeight(int height) {
- this.height = height;
- }
-
- public Size getSize() {
- return size;
- }
-
- public void setSize(Size size) {
- this.size = size;
- }
-
- public enum Size {
- SMALL, LARGE
- }
-}
\ No newline at end of file
diff --git a/dubbo-serialization/dubbo-serialization-fastjson/src/test/java/org/apache/dubbo/common/serialize/fastjson/model/Person.java b/dubbo-serialization/dubbo-serialization-fastjson/src/test/java/org/apache/dubbo/common/serialize/fastjson/model/Person.java
deleted file mode 100644
index eadb684..0000000
--- a/dubbo-serialization/dubbo-serialization-fastjson/src/test/java/org/apache/dubbo/common/serialize/fastjson/model/Person.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.dubbo.common.serialize.fastjson.model;
-
-public class Person {
- private String name;
- private int age;
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public int getAge() {
- return age;
- }
-
- public void setAge(int age) {
- this.age = age;
- }
-}
diff --git a/dubbo-serialization/dubbo-serialization-fastjson/src/test/resources/log4j.xml b/dubbo-serialization/dubbo-serialization-fastjson/src/test/resources/log4j.xml
deleted file mode 100644
index d045b92..0000000
--- a/dubbo-serialization/dubbo-serialization-fastjson/src/test/resources/log4j.xml
+++ /dev/null
@@ -1,32 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- - Copyright 1999-2011 Alibaba Group.
- -
- - Licensed under the Apache License, Version 2.0 (the "License");
- - you may not use this file except in compliance with the License.
- - You may obtain a copy of the License at
- -
- - http://www.apache.org/licenses/LICENSE-2.0
- -
- - Unless required by applicable law or agreed to in writing, software
- - distributed under the License is distributed on an "AS IS" BASIS,
- - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- - See the License for the specific language governing permissions and
- - limitations under the License.
--->
-<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
-<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
- <!-- ===================================================================== -->
- <!-- 以下是appender的定义 -->
- <!-- ===================================================================== -->
- <appender name="dubbo" class="org.apache.dubbo.common.utils.DubboAppender">
- <param name="encoding" value="GBK"/>
- <layout class="org.apache.log4j.PatternLayout">
- <param name="ConversionPattern" value="%d %p [%c:%M] - %m%n"/>
- </layout>
- </appender>
- <root>
- <level value="INFO"/>
- <appender-ref ref="dubbo"/>
- </root>
-</log4j:configuration>
\ No newline at end of file
diff --git a/dubbo-serialization/dubbo-serialization-fst/src/test/java/org/apache/dubbo/common/serialize/fst/model/AnimalEnum.java b/dubbo-serialization/dubbo-serialization-fst/src/test/java/org/apache/dubbo/common/serialize/fst/model/AnimalEnum.java
deleted file mode 100644
index 0f1b98b..0000000
--- a/dubbo-serialization/dubbo-serialization-fst/src/test/java/org/apache/dubbo/common/serialize/fst/model/AnimalEnum.java
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.dubbo.common.serialize.fst.model;
-
-public enum AnimalEnum {
- dog, cat, rat, cow, bull, horse;
-}
\ No newline at end of file
diff --git a/dubbo-serialization/dubbo-serialization-fst/src/test/java/org/apache/dubbo/common/serialize/fst/model/FullAddress.java b/dubbo-serialization/dubbo-serialization-fst/src/test/java/org/apache/dubbo/common/serialize/fst/model/FullAddress.java
deleted file mode 100644
index d3f88a9..0000000
--- a/dubbo-serialization/dubbo-serialization-fst/src/test/java/org/apache/dubbo/common/serialize/fst/model/FullAddress.java
+++ /dev/null
@@ -1,199 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.dubbo.common.serialize.fst.model;
-
-import java.io.Serializable;
-
-public class FullAddress implements Serializable {
-
- private static final long serialVersionUID = 5163979984269419831L;
-
- private String countryId;
-
- private String countryName;
-
- private String provinceName;
-
- private String cityId;
-
- private String cityName;
-
- private String streetAddress;
-
- private String zipCode;
-
- public FullAddress(String countryId, String provinceName, String cityId, String streetAddress,
- String zipCode) {
- this.countryId = countryId;
- this.countryName = countryId;
- this.provinceName = provinceName;
- this.cityId = cityId;
- this.cityName = cityId;
- this.streetAddress = streetAddress;
- this.zipCode = zipCode;
- }
-
- public FullAddress(String countryId, String countryName, String provinceName, String cityId,
- String cityName, String streetAddress, String zipCode) {
- this.countryId = countryId;
- this.countryName = countryName;
- this.provinceName = provinceName;
- this.cityId = cityId;
- this.cityName = cityName;
- this.streetAddress = streetAddress;
- this.zipCode = zipCode;
- }
-
- public String getCountryId() {
- return countryId;
- }
-
- public void setCountryId(String countryId) {
- this.countryId = countryId;
- }
-
- public String getCountryName() {
- return countryName;
- }
-
- public void setCountryName(String countryName) {
- this.countryName = countryName;
- }
-
- public String getProvinceName() {
- return provinceName;
- }
-
- public void setProvinceName(String provinceName) {
- this.provinceName = provinceName;
- }
-
- public String getCityId() {
- return cityId;
- }
-
- public void setCityId(String cityId) {
- this.cityId = cityId;
- }
-
- public String getCityName() {
- return cityName;
- }
-
- public void setCityName(String cityName) {
- this.cityName = cityName;
- }
-
- public String getStreetAddress() {
- return streetAddress;
- }
-
- public void setStreetAddress(String streetAddress) {
- this.streetAddress = streetAddress;
- }
-
- public String getZipCode() {
- return zipCode;
- }
-
- public void setZipCode(String zipCode) {
- this.zipCode = zipCode;
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + ((cityId == null) ? 0 : cityId.hashCode());
- result = prime * result + ((cityName == null) ? 0 : cityName.hashCode());
- result = prime * result + ((countryId == null) ? 0 : countryId.hashCode());
- result = prime * result + ((countryName == null) ? 0 : countryName.hashCode());
- result = prime * result + ((provinceName == null) ? 0 : provinceName.hashCode());
- result = prime * result + ((streetAddress == null) ? 0 : streetAddress.hashCode());
- result = prime * result + ((zipCode == null) ? 0 : zipCode.hashCode());
- return result;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj)
- return true;
- if (obj == null)
- return false;
- if (getClass() != obj.getClass())
- return false;
- FullAddress other = (FullAddress) obj;
- if (cityId == null) {
- if (other.cityId != null)
- return false;
- } else if (!cityId.equals(other.cityId))
- return false;
- if (cityName == null) {
- if (other.cityName != null)
- return false;
- } else if (!cityName.equals(other.cityName))
- return false;
- if (countryId == null) {
- if (other.countryId != null)
- return false;
- } else if (!countryId.equals(other.countryId))
- return false;
- if (countryName == null) {
- if (other.countryName != null)
- return false;
- } else if (!countryName.equals(other.countryName))
- return false;
- if (provinceName == null) {
- if (other.provinceName != null)
- return false;
- } else if (!provinceName.equals(other.provinceName))
- return false;
- if (streetAddress == null) {
- if (other.streetAddress != null)
- return false;
- } else if (!streetAddress.equals(other.streetAddress))
- return false;
- if (zipCode == null) {
- if (other.zipCode != null)
- return false;
- } else if (!zipCode.equals(other.zipCode))
- return false;
- return true;
- }
-
- @Override
- public String toString() {
- StringBuilder sb = new StringBuilder();
- if (countryName != null && countryName.length() > 0) {
- sb.append(countryName);
- }
- if (provinceName != null && provinceName.length() > 0) {
- sb.append(" ");
- sb.append(provinceName);
- }
- if (cityName != null && cityName.length() > 0) {
- sb.append(" ");
- sb.append(cityName);
- }
- if (streetAddress != null && streetAddress.length() > 0) {
- sb.append(" ");
- sb.append(streetAddress);
- }
- return sb.toString();
- }
-
-}
\ No newline at end of file
diff --git a/dubbo-serialization/dubbo-serialization-fst/src/test/resources/log4j.xml b/dubbo-serialization/dubbo-serialization-fst/src/test/resources/log4j.xml
deleted file mode 100644
index d045b92..0000000
--- a/dubbo-serialization/dubbo-serialization-fst/src/test/resources/log4j.xml
+++ /dev/null
@@ -1,32 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- - Copyright 1999-2011 Alibaba Group.
- -
- - Licensed under the Apache License, Version 2.0 (the "License");
- - you may not use this file except in compliance with the License.
- - You may obtain a copy of the License at
- -
- - http://www.apache.org/licenses/LICENSE-2.0
- -
- - Unless required by applicable law or agreed to in writing, software
- - distributed under the License is distributed on an "AS IS" BASIS,
- - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- - See the License for the specific language governing permissions and
- - limitations under the License.
--->
-<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
-<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
- <!-- ===================================================================== -->
- <!-- 以下是appender的定义 -->
- <!-- ===================================================================== -->
- <appender name="dubbo" class="org.apache.dubbo.common.utils.DubboAppender">
- <param name="encoding" value="GBK"/>
- <layout class="org.apache.log4j.PatternLayout">
- <param name="ConversionPattern" value="%d %p [%c:%M] - %m%n"/>
- </layout>
- </appender>
- <root>
- <level value="INFO"/>
- <appender-ref ref="dubbo"/>
- </root>
-</log4j:configuration>
\ No newline at end of file
diff --git a/dubbo-serialization/dubbo-serialization-hessian2/src/test/java/org/apache/dubbo/common/model/AnimalEnum.java b/dubbo-serialization/dubbo-serialization-hessian2/src/test/java/org/apache/dubbo/common/model/AnimalEnum.java
deleted file mode 100644
index 760663f..0000000
--- a/dubbo-serialization/dubbo-serialization-hessian2/src/test/java/org/apache/dubbo/common/model/AnimalEnum.java
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.dubbo.common.model;
-
-public enum AnimalEnum {
- dog, cat, rat, cow, bull, horse;
-}
\ No newline at end of file
diff --git a/dubbo-serialization/dubbo-serialization-hessian2/src/test/java/org/apache/dubbo/common/model/BizExceptionNoDefaultConstructor.java b/dubbo-serialization/dubbo-serialization-hessian2/src/test/java/org/apache/dubbo/common/model/BizExceptionNoDefaultConstructor.java
deleted file mode 100644
index f1ffadb..0000000
--- a/dubbo-serialization/dubbo-serialization-hessian2/src/test/java/org/apache/dubbo/common/model/BizExceptionNoDefaultConstructor.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.dubbo.common.model;
-
-public class BizExceptionNoDefaultConstructor extends RuntimeException {
-
- private static final long serialVersionUID = 1L;
-
- public BizExceptionNoDefaultConstructor(String message) {
- super(message);
- }
-}
\ No newline at end of file
diff --git a/dubbo-serialization/dubbo-serialization-hessian2/src/test/java/org/apache/dubbo/common/model/SerializablePerson.java b/dubbo-serialization/dubbo-serialization-hessian2/src/test/java/org/apache/dubbo/common/model/SerializablePerson.java
deleted file mode 100644
index d78c592..0000000
--- a/dubbo-serialization/dubbo-serialization-hessian2/src/test/java/org/apache/dubbo/common/model/SerializablePerson.java
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.dubbo.common.model;
-
-import java.io.Serializable;
-import java.util.Arrays;
-
-public class SerializablePerson implements Serializable {
- private static final long serialVersionUID = 1L;
- byte oneByte = 123;
- private String name = "name1";
- private int age = 11;
-
- private String[] value = {"value1", "value2"};
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public byte getOneByte() {
- return oneByte;
- }
-
- public void setOneByte(byte b) {
- this.oneByte = b;
- }
-
- public int getAge() {
- return age;
- }
-
- public void setAge(int age) {
- this.age = age;
- }
-
- public String[] getValue() {
- return value;
- }
-
- public void setValue(String[] value) {
- this.value = value;
- }
-
- @Override
- public String toString() {
- return String.format("Person name(%s) age(%d) byte(%s) [value=%s]", name, age, oneByte, Arrays.toString(value));
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + age;
- result = prime * result + ((name == null) ? 0 : name.hashCode());
- result = prime * result + Arrays.hashCode(value);
- return result;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj)
- return true;
- if (obj == null)
- return false;
- if (getClass() != obj.getClass())
- return false;
- SerializablePerson other = (SerializablePerson) obj;
- if (age != other.age)
- return false;
- if (name == null) {
- if (other.name != null)
- return false;
- } else if (!name.equals(other.name))
- return false;
- if (!Arrays.equals(value, other.value))
- return false;
- return true;
- }
-}
\ No newline at end of file
diff --git a/dubbo-serialization/dubbo-serialization-hessian2/src/test/java/org/apache/dubbo/common/model/media/MediaContent.java b/dubbo-serialization/dubbo-serialization-hessian2/src/test/java/org/apache/dubbo/common/model/media/MediaContent.java
deleted file mode 100644
index 7991f50..0000000
--- a/dubbo-serialization/dubbo-serialization-hessian2/src/test/java/org/apache/dubbo/common/model/media/MediaContent.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.dubbo.common.model.media;
-
-import java.util.List;
-
-@SuppressWarnings("serial")
-public class MediaContent implements java.io.Serializable {
- public Media media;
- public List<Image> images;
-
- public MediaContent() {
- }
-
- public MediaContent(Media media, List<Image> images) {
- this.media = media;
- this.images = images;
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o) return true;
- if (o == null || getClass() != o.getClass()) return false;
-
- MediaContent that = (MediaContent) o;
-
- if (images != null ? !images.equals(that.images) : that.images != null) return false;
- if (media != null ? !media.equals(that.media) : that.media != null) return false;
-
- return true;
- }
-
- @Override
- public int hashCode() {
- int result = media != null ? media.hashCode() : 0;
- result = 31 * result + (images != null ? images.hashCode() : 0);
- return result;
- }
-
- public String toString() {
- StringBuilder sb = new StringBuilder();
- sb.append("[MediaContent: ");
- sb.append("media=").append(media);
- sb.append(", images=").append(images);
- sb.append("]");
- return sb.toString();
- }
-
- public Media getMedia() {
- return media;
- }
-
- public void setMedia(Media media) {
- this.media = media;
- }
-
- public List<Image> getImages() {
- return images;
- }
-
- public void setImages(List<Image> images) {
- this.images = images;
- }
-}
\ No newline at end of file
diff --git a/dubbo-serialization/dubbo-serialization-hessian2/src/test/java/org/apache/dubbo/common/model/person/PersonStatus.java b/dubbo-serialization/dubbo-serialization-hessian2/src/test/java/org/apache/dubbo/common/model/person/PersonStatus.java
deleted file mode 100644
index 62869c2..0000000
--- a/dubbo-serialization/dubbo-serialization-hessian2/src/test/java/org/apache/dubbo/common/model/person/PersonStatus.java
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.dubbo.common.model.person;
-
-public enum PersonStatus {
- ENABLED,
- DISABLED
-}
\ No newline at end of file
diff --git a/dubbo-serialization/dubbo-serialization-hessian2/src/test/java/org/apache/dubbo/common/model/person/Phone.java b/dubbo-serialization/dubbo-serialization-hessian2/src/test/java/org/apache/dubbo/common/model/person/Phone.java
deleted file mode 100644
index 41fd38a..0000000
--- a/dubbo-serialization/dubbo-serialization-hessian2/src/test/java/org/apache/dubbo/common/model/person/Phone.java
+++ /dev/null
@@ -1,139 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.dubbo.common.model.person;
-
-import java.io.Serializable;
-
-public class Phone implements Serializable {
-
- private static final long serialVersionUID = 4399060521859707703L;
-
- private String country;
-
- private String area;
-
- private String number;
-
- private String extensionNumber;
-
- public Phone() {
- }
-
- public Phone(String country, String area, String number, String extensionNumber) {
- this.country = country;
- this.area = area;
- this.number = number;
- this.extensionNumber = extensionNumber;
- }
-
- public String getCountry() {
- return country;
- }
-
- public void setCountry(String country) {
- this.country = country;
- }
-
- public String getArea() {
- return area;
- }
-
- public void setArea(String area) {
- this.area = area;
- }
-
- public String getNumber() {
- return number;
- }
-
- public void setNumber(String number) {
- this.number = number;
- }
-
- public String getExtensionNumber() {
- return extensionNumber;
- }
-
- public void setExtensionNumber(String extensionNumber) {
- this.extensionNumber = extensionNumber;
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + ((area == null) ? 0 : area.hashCode());
- result = prime * result + ((country == null) ? 0 : country.hashCode());
- result = prime * result + ((extensionNumber == null) ? 0 : extensionNumber.hashCode());
- result = prime * result + ((number == null) ? 0 : number.hashCode());
- return result;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj)
- return true;
- if (obj == null)
- return false;
- if (getClass() != obj.getClass())
- return false;
- Phone other = (Phone) obj;
- if (area == null) {
- if (other.area != null)
- return false;
- } else if (!area.equals(other.area))
- return false;
- if (country == null) {
- if (other.country != null)
- return false;
- } else if (!country.equals(other.country))
- return false;
- if (extensionNumber == null) {
- if (other.extensionNumber != null)
- return false;
- } else if (!extensionNumber.equals(other.extensionNumber))
- return false;
- if (number == null) {
- if (other.number != null)
- return false;
- } else if (!number.equals(other.number))
- return false;
- return true;
- }
-
- @Override
- public String toString() {
- StringBuilder sb = new StringBuilder();
- if (country != null && country.length() > 0) {
- sb.append(country);
- sb.append("-");
- }
- if (area != null && area.length() > 0) {
- sb.append(area);
- sb.append("-");
- }
- if (number != null && number.length() > 0) {
- sb.append(number);
- }
- if (extensionNumber != null && extensionNumber.length() > 0) {
- sb.append("-");
- sb.append(extensionNumber);
- }
- return sb.toString();
- }
-
-}
\ No newline at end of file
diff --git a/dubbo-serialization/dubbo-serialization-hessian2/src/test/java/org/apache/dubbo/common/serialize/serialization/AbstractSerializationPersonFailTest.java b/dubbo-serialization/dubbo-serialization-hessian2/src/test/java/org/apache/dubbo/common/serialize/serialization/AbstractSerializationPersonFailTest.java
deleted file mode 100644
index 5d27bb5..0000000
--- a/dubbo-serialization/dubbo-serialization-hessian2/src/test/java/org/apache/dubbo/common/serialize/serialization/AbstractSerializationPersonFailTest.java
+++ /dev/null
@@ -1,137 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.dubbo.common.serialize.serialization;
-
-import org.apache.dubbo.common.model.Person;
-import org.apache.dubbo.common.serialize.ObjectOutput;
-
-import org.junit.Test;
-
-import java.io.NotSerializableException;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import static org.junit.Assert.assertThat;
-import static org.junit.Assert.fail;
-import static org.junit.matchers.JUnitMatchers.containsString;
-
-public abstract class AbstractSerializationPersonFailTest extends AbstractSerializationTest {
- @Test
- public void test_Person() throws Exception {
- try {
- ObjectOutput objectOutput = serialization.serialize(url, byteArrayOutputStream);
- objectOutput.writeObject(new Person());
- fail();
- } catch (NotSerializableException expected) {
- } catch (IllegalStateException expected) {
- assertThat(expected.getMessage(), containsString("Serialized class org.apache.dubbo.common.model.Person must implement java.io.Serializable"));
- }
- }
-
- @Test
- public void test_PersonList() throws Exception {
- List<Person> args = new ArrayList<Person>();
- args.add(new Person());
- try {
- ObjectOutput objectOutput = serialization.serialize(url, byteArrayOutputStream);
- objectOutput.writeObject(args);
- fail();
- } catch (NotSerializableException expected) {
- } catch (IllegalStateException expected) {
- assertThat(expected.getMessage(), containsString("Serialized class org.apache.dubbo.common.model.Person must implement java.io.Serializable"));
- }
- }
-
- @Test
- public void test_PersonSet() throws Exception {
- Set<Person> args = new HashSet<Person>();
- args.add(new Person());
- try {
- ObjectOutput objectOutput = serialization.serialize(url, byteArrayOutputStream);
- objectOutput.writeObject(args);
- fail();
- } catch (NotSerializableException expected) {
- } catch (IllegalStateException expected) {
- assertThat(expected.getMessage(), containsString("Serialized class org.apache.dubbo.common.model.Person must implement java.io.Serializable"));
- }
- }
-
- @Test
- public void test_IntPersonMap() throws Exception {
- Map<Integer, Person> args = new HashMap<Integer, Person>();
- args.put(1, new Person());
- try {
- ObjectOutput objectOutput = serialization.serialize(url, byteArrayOutputStream);
- objectOutput.writeObject(args);
- fail();
- } catch (NotSerializableException expected) {
- } catch (IllegalStateException expected) {
- assertThat(expected.getMessage(), containsString("Serialized class org.apache.dubbo.common.model.Person must implement java.io.Serializable"));
- }
- }
-
- @Test
- public void test_StringPersonMap() throws Exception {
- Map<String, Person> args = new HashMap<String, Person>();
- args.put("1", new Person());
- try {
- ObjectOutput objectOutput = serialization.serialize(url, byteArrayOutputStream);
- objectOutput.writeObject(args);
- fail();
- } catch (NotSerializableException expected) {
- } catch (IllegalStateException expected) {
- assertThat(expected.getMessage(), containsString("Serialized class org.apache.dubbo.common.model.Person must implement java.io.Serializable"));
- }
- }
-
- @Test
- public void test_StringPersonListMap() throws Exception {
- Map<String, List<Person>> args = new HashMap<String, List<Person>>();
-
- List<Person> sublist = new ArrayList<Person>();
- sublist.add(new Person());
- args.put("1", sublist);
- try {
- ObjectOutput objectOutput = serialization.serialize(url, byteArrayOutputStream);
- objectOutput.writeObject(args);
- fail();
- } catch (NotSerializableException expected) {
- } catch (IllegalStateException expected) {
- assertThat(expected.getMessage(), containsString("Serialized class org.apache.dubbo.common.model.Person must implement java.io.Serializable"));
- }
- }
-
- @Test
- public void test_PersonListList() throws Exception {
- List<List<Person>> args = new ArrayList<List<Person>>();
- List<Person> sublist = new ArrayList<Person>();
- sublist.add(new Person());
- args.add(sublist);
- try {
- ObjectOutput objectOutput = serialization.serialize(url, byteArrayOutputStream);
- objectOutput.writeObject(args);
- fail();
- } catch (NotSerializableException expected) {
- } catch (IllegalStateException expected) {
- assertThat(expected.getMessage(), containsString("Serialized class org.apache.dubbo.common.model.Person must implement java.io.Serializable"));
- }
- }
-}
\ No newline at end of file
diff --git a/dubbo-serialization/dubbo-serialization-hessian2/src/test/resources/log4j.xml b/dubbo-serialization/dubbo-serialization-hessian2/src/test/resources/log4j.xml
deleted file mode 100644
index d045b92..0000000
--- a/dubbo-serialization/dubbo-serialization-hessian2/src/test/resources/log4j.xml
+++ /dev/null
@@ -1,32 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- - Copyright 1999-2011 Alibaba Group.
- -
- - Licensed under the Apache License, Version 2.0 (the "License");
- - you may not use this file except in compliance with the License.
- - You may obtain a copy of the License at
- -
- - http://www.apache.org/licenses/LICENSE-2.0
- -
- - Unless required by applicable law or agreed to in writing, software
- - distributed under the License is distributed on an "AS IS" BASIS,
- - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- - See the License for the specific language governing permissions and
- - limitations under the License.
--->
-<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
-<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
- <!-- ===================================================================== -->
- <!-- 以下是appender的定义 -->
- <!-- ===================================================================== -->
- <appender name="dubbo" class="org.apache.dubbo.common.utils.DubboAppender">
- <param name="encoding" value="GBK"/>
- <layout class="org.apache.log4j.PatternLayout">
- <param name="ConversionPattern" value="%d %p [%c:%M] - %m%n"/>
- </layout>
- </appender>
- <root>
- <level value="INFO"/>
- <appender-ref ref="dubbo"/>
- </root>
-</log4j:configuration>
\ No newline at end of file
diff --git a/dubbo-serialization/dubbo-serialization-hessian2/src/test/resources/org/apache/dubbo/common/serialize/dubbo/SimpleDO.fc b/dubbo-serialization/dubbo-serialization-hessian2/src/test/resources/org/apache/dubbo/common/serialize/dubbo/SimpleDO.fc
deleted file mode 100644
index c8c083c..0000000
--- a/dubbo-serialization/dubbo-serialization-hessian2/src/test/resources/org/apache/dubbo/common/serialize/dubbo/SimpleDO.fc
+++ /dev/null
@@ -1,2 +0,0 @@
-a,d,e,b,c
-str3,str2
\ No newline at end of file
diff --git a/dubbo-serialization/dubbo-serialization-jdk/src/test/java/org/apache/dubbo/common/model/AnimalEnum.java b/dubbo-serialization/dubbo-serialization-jdk/src/test/java/org/apache/dubbo/common/model/AnimalEnum.java
deleted file mode 100644
index 760663f..0000000
--- a/dubbo-serialization/dubbo-serialization-jdk/src/test/java/org/apache/dubbo/common/model/AnimalEnum.java
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.dubbo.common.model;
-
-public enum AnimalEnum {
- dog, cat, rat, cow, bull, horse;
-}
\ No newline at end of file
diff --git a/dubbo-serialization/dubbo-serialization-jdk/src/test/java/org/apache/dubbo/common/model/BizException.java b/dubbo-serialization/dubbo-serialization-jdk/src/test/java/org/apache/dubbo/common/model/BizException.java
deleted file mode 100644
index 95f4046..0000000
--- a/dubbo-serialization/dubbo-serialization-jdk/src/test/java/org/apache/dubbo/common/model/BizException.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.dubbo.common.model;
-
-public class BizException extends RuntimeException {
-
- private static final long serialVersionUID = 1L;
-
- public BizException(String message) {
- super(message);
- }
-
- public BizException() {
- }
-}
\ No newline at end of file
diff --git a/dubbo-serialization/dubbo-serialization-jdk/src/test/java/org/apache/dubbo/common/model/Person.java b/dubbo-serialization/dubbo-serialization-jdk/src/test/java/org/apache/dubbo/common/model/Person.java
deleted file mode 100644
index 5a551a7..0000000
--- a/dubbo-serialization/dubbo-serialization-jdk/src/test/java/org/apache/dubbo/common/model/Person.java
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.dubbo.common.model;
-
-import java.util.Arrays;
-
-public class Person {
- byte oneByte = 123;
- private String name = "name1";
- private int age = 11;
-
- private String[] value = {"value1", "value2"};
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public byte getOneByte() {
- return oneByte;
- }
-
- public void setOneByte(byte b) {
- this.oneByte = b;
- }
-
- public int getAge() {
- return age;
- }
-
- public void setAge(int age) {
- this.age = age;
- }
-
- public String[] getValue() {
- return value;
- }
-
- public void setValue(String[] value) {
- this.value = value;
- }
-
- @Override
- public String toString() {
- return String.format("Person name(%s) age(%d) byte(%s) [value=%s]", name, age, oneByte, Arrays.toString(value));
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + age;
- result = prime * result + ((name == null) ? 0 : name.hashCode());
- result = prime * result + Arrays.hashCode(value);
- return result;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj)
- return true;
- if (obj == null)
- return false;
- if (getClass() != obj.getClass())
- return false;
- Person other = (Person) obj;
- if (age != other.age)
- return false;
- if (name == null) {
- if (other.name != null)
- return false;
- } else if (!name.equals(other.name))
- return false;
- if (!Arrays.equals(value, other.value))
- return false;
- return true;
- }
-}
\ No newline at end of file
diff --git a/dubbo-serialization/dubbo-serialization-jdk/src/test/java/org/apache/dubbo/common/model/SerializablePerson.java b/dubbo-serialization/dubbo-serialization-jdk/src/test/java/org/apache/dubbo/common/model/SerializablePerson.java
deleted file mode 100644
index d78c592..0000000
--- a/dubbo-serialization/dubbo-serialization-jdk/src/test/java/org/apache/dubbo/common/model/SerializablePerson.java
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.dubbo.common.model;
-
-import java.io.Serializable;
-import java.util.Arrays;
-
-public class SerializablePerson implements Serializable {
- private static final long serialVersionUID = 1L;
- byte oneByte = 123;
- private String name = "name1";
- private int age = 11;
-
- private String[] value = {"value1", "value2"};
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public byte getOneByte() {
- return oneByte;
- }
-
- public void setOneByte(byte b) {
- this.oneByte = b;
- }
-
- public int getAge() {
- return age;
- }
-
- public void setAge(int age) {
- this.age = age;
- }
-
- public String[] getValue() {
- return value;
- }
-
- public void setValue(String[] value) {
- this.value = value;
- }
-
- @Override
- public String toString() {
- return String.format("Person name(%s) age(%d) byte(%s) [value=%s]", name, age, oneByte, Arrays.toString(value));
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + age;
- result = prime * result + ((name == null) ? 0 : name.hashCode());
- result = prime * result + Arrays.hashCode(value);
- return result;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj)
- return true;
- if (obj == null)
- return false;
- if (getClass() != obj.getClass())
- return false;
- SerializablePerson other = (SerializablePerson) obj;
- if (age != other.age)
- return false;
- if (name == null) {
- if (other.name != null)
- return false;
- } else if (!name.equals(other.name))
- return false;
- if (!Arrays.equals(value, other.value))
- return false;
- return true;
- }
-}
\ No newline at end of file
diff --git a/dubbo-serialization/dubbo-serialization-jdk/src/test/java/org/apache/dubbo/common/model/media/Image.java b/dubbo-serialization/dubbo-serialization-jdk/src/test/java/org/apache/dubbo/common/model/media/Image.java
deleted file mode 100644
index a59eff3..0000000
--- a/dubbo-serialization/dubbo-serialization-jdk/src/test/java/org/apache/dubbo/common/model/media/Image.java
+++ /dev/null
@@ -1,120 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.dubbo.common.model.media;
-
-
-public class Image implements java.io.Serializable {
- private static final long serialVersionUID = 1L;
- public String uri;
- public String title; // Can be null
- public int width;
- public int height;
- public Size size;
-
- public Image() {
- }
-
- public Image(String uri, String title, int width, int height, Size size) {
- this.height = height;
- this.title = title;
- this.uri = uri;
- this.width = width;
- this.size = size;
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o) return true;
- if (o == null || getClass() != o.getClass()) return false;
-
- Image image = (Image) o;
-
- if (height != image.height) return false;
- if (width != image.width) return false;
- if (size != image.size) return false;
- if (title != null ? !title.equals(image.title) : image.title != null) return false;
- if (uri != null ? !uri.equals(image.uri) : image.uri != null) return false;
-
- return true;
- }
-
- @Override
- public int hashCode() {
- int result = uri != null ? uri.hashCode() : 0;
- result = 31 * result + (title != null ? title.hashCode() : 0);
- result = 31 * result + width;
- result = 31 * result + height;
- result = 31 * result + (size != null ? size.hashCode() : 0);
- return result;
- }
-
- public String toString() {
- StringBuilder sb = new StringBuilder();
- sb.append("[Image ");
- sb.append("uri=").append(uri);
- sb.append(", title=").append(title);
- sb.append(", width=").append(width);
- sb.append(", height=").append(height);
- sb.append(", size=").append(size);
- sb.append("]");
- return sb.toString();
- }
-
- public String getUri() {
- return uri;
- }
-
- public void setUri(String uri) {
- this.uri = uri;
- }
-
- public String getTitle() {
- return title;
- }
-
- public void setTitle(String title) {
- this.title = title;
- }
-
- public int getWidth() {
- return width;
- }
-
- public void setWidth(int width) {
- this.width = width;
- }
-
- public int getHeight() {
- return height;
- }
-
- public void setHeight(int height) {
- this.height = height;
- }
-
- public Size getSize() {
- return size;
- }
-
- public void setSize(Size size) {
- this.size = size;
- }
-
- public enum Size {
- SMALL, LARGE
- }
-}
\ No newline at end of file
diff --git a/dubbo-serialization/dubbo-serialization-jdk/src/test/java/org/apache/dubbo/common/model/media/Media.java b/dubbo-serialization/dubbo-serialization-jdk/src/test/java/org/apache/dubbo/common/model/media/Media.java
deleted file mode 100644
index 042a3a5..0000000
--- a/dubbo-serialization/dubbo-serialization-jdk/src/test/java/org/apache/dubbo/common/model/media/Media.java
+++ /dev/null
@@ -1,205 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.dubbo.common.model.media;
-
-import java.util.List;
-
-@SuppressWarnings("serial")
-public class Media implements java.io.Serializable {
- public String uri;
- public String title; // Can be unset.
- public int width;
- public int height;
- public String format;
- public long duration;
- public long size;
- public int bitrate; // Can be unset.
- public boolean hasBitrate;
- public List<String> persons;
- public Player player;
- public String copyright; // Can be unset.
-
- public Media() {
- }
-
- public Media(String uri, String title, int width, int height, String format, long duration, long size, int bitrate, boolean hasBitrate, List<String> persons, Player player, String copyright) {
- this.uri = uri;
- this.title = title;
- this.width = width;
- this.height = height;
- this.format = format;
- this.duration = duration;
- this.size = size;
- this.bitrate = bitrate;
- this.hasBitrate = hasBitrate;
- this.persons = persons;
- this.player = player;
- this.copyright = copyright;
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o) return true;
- if (o == null || getClass() != o.getClass()) return false;
-
- Media media = (Media) o;
-
- if (bitrate != media.bitrate) return false;
- if (duration != media.duration) return false;
- if (hasBitrate != media.hasBitrate) return false;
- if (height != media.height) return false;
- if (size != media.size) return false;
- if (width != media.width) return false;
- if (copyright != null ? !copyright.equals(media.copyright) : media.copyright != null) return false;
- if (format != null ? !format.equals(media.format) : media.format != null) return false;
- if (persons != null ? !persons.equals(media.persons) : media.persons != null) return false;
- if (player != media.player) return false;
- if (title != null ? !title.equals(media.title) : media.title != null) return false;
- if (uri != null ? !uri.equals(media.uri) : media.uri != null) return false;
-
- return true;
- }
-
- @Override
- public int hashCode() {
- int result = uri != null ? uri.hashCode() : 0;
- result = 31 * result + (title != null ? title.hashCode() : 0);
- result = 31 * result + width;
- result = 31 * result + height;
- result = 31 * result + (format != null ? format.hashCode() : 0);
- result = 31 * result + (int) (duration ^ (duration >>> 32));
- result = 31 * result + (int) (size ^ (size >>> 32));
- result = 31 * result + bitrate;
- result = 31 * result + (hasBitrate ? 1 : 0);
- result = 31 * result + (persons != null ? persons.hashCode() : 0);
- result = 31 * result + (player != null ? player.hashCode() : 0);
- result = 31 * result + (copyright != null ? copyright.hashCode() : 0);
- return result;
- }
-
- public String toString() {
- StringBuilder sb = new StringBuilder();
- sb.append("[Media ");
- sb.append("uri=").append(uri);
- sb.append(", title=").append(title);
- sb.append(", width=").append(width);
- sb.append(", height=").append(height);
- sb.append(", format=").append(format);
- sb.append(", duration=").append(duration);
- sb.append(", size=").append(size);
- sb.append(", hasBitrate=").append(hasBitrate);
- sb.append(", bitrate=").append(String.valueOf(bitrate));
- sb.append(", persons=").append(persons);
- sb.append(", player=").append(player);
- sb.append(", copyright=").append(copyright);
- sb.append("]");
- return sb.toString();
- }
-
- public String getUri() {
- return uri;
- }
-
- public void setUri(String uri) {
- this.uri = uri;
- }
-
- public String getTitle() {
- return title;
- }
-
- public void setTitle(String title) {
- this.title = title;
- }
-
- public int getWidth() {
- return width;
- }
-
- public void setWidth(int width) {
- this.width = width;
- }
-
- public int getHeight() {
- return height;
- }
-
- public void setHeight(int height) {
- this.height = height;
- }
-
- public String getFormat() {
- return format;
- }
-
- public void setFormat(String format) {
- this.format = format;
- }
-
- public long getDuration() {
- return duration;
- }
-
- public void setDuration(long duration) {
- this.duration = duration;
- }
-
- public long getSize() {
- return size;
- }
-
- public void setSize(long size) {
- this.size = size;
- }
-
- public int getBitrate() {
- return bitrate;
- }
-
- public void setBitrate(int bitrate) {
- this.bitrate = bitrate;
- this.hasBitrate = true;
- }
-
- public List<String> getPersons() {
- return persons;
- }
-
- public void setPersons(List<String> persons) {
- this.persons = persons;
- }
-
- public Player getPlayer() {
- return player;
- }
-
- public void setPlayer(Player player) {
- this.player = player;
- }
-
- public String getCopyright() {
- return copyright;
- }
-
- public void setCopyright(String copyright) {
- this.copyright = copyright;
- }
-
- public enum Player {
- JAVA, FLASH
- }
-}
\ No newline at end of file
diff --git a/dubbo-serialization/dubbo-serialization-jdk/src/test/java/org/apache/dubbo/common/model/person/BigPerson.java b/dubbo-serialization/dubbo-serialization-jdk/src/test/java/org/apache/dubbo/common/model/person/BigPerson.java
deleted file mode 100644
index 4ce7900..0000000
--- a/dubbo-serialization/dubbo-serialization-jdk/src/test/java/org/apache/dubbo/common/model/person/BigPerson.java
+++ /dev/null
@@ -1,151 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.dubbo.common.model.person;
-
-import java.io.Serializable;
-
-public class BigPerson implements Serializable {
- private static final long serialVersionUID = 1L;
-
- String personId;
-
- String loginName;
-
- PersonStatus status;
-
- String email;
-
- String penName;
-
- PersonInfo infoProfile;
-
- public BigPerson() {
-
- }
-
- public BigPerson(String id) {
- this.personId = id;
- }
-
- public String getPersonId() {
- return personId;
- }
-
- public void setPersonId(String personId) {
- this.personId = personId;
- }
-
- public PersonInfo getInfoProfile() {
- return infoProfile;
- }
-
- public void setInfoProfile(PersonInfo infoProfile) {
- this.infoProfile = infoProfile;
- }
-
- public String getEmail() {
- return this.email;
- }
-
- public void setEmail(String email) {
- this.email = email;
- }
-
- public String getLoginName() {
- return this.loginName;
- }
-
- public void setLoginName(String loginName) {
- this.loginName = loginName;
- }
-
- public PersonStatus getStatus() {
- return this.status;
- }
-
- public void setStatus(PersonStatus status) {
- this.status = status;
- }
-
- public String getPenName() {
- return penName;
- }
-
- public void setPenName(String penName) {
- this.penName = penName;
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + ((email == null) ? 0 : email.hashCode());
- result = prime * result + ((infoProfile == null) ? 0 : infoProfile.hashCode());
- result = prime * result + ((loginName == null) ? 0 : loginName.hashCode());
- result = prime * result + ((penName == null) ? 0 : penName.hashCode());
- result = prime * result + ((personId == null) ? 0 : personId.hashCode());
- result = prime * result + ((status == null) ? 0 : status.hashCode());
- return result;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj)
- return true;
- if (obj == null)
- return false;
- if (getClass() != obj.getClass())
- return false;
- BigPerson other = (BigPerson) obj;
- if (email == null) {
- if (other.email != null)
- return false;
- } else if (!email.equals(other.email))
- return false;
- if (infoProfile == null) {
- if (other.infoProfile != null)
- return false;
- } else if (!infoProfile.equals(other.infoProfile))
- return false;
- if (loginName == null) {
- if (other.loginName != null)
- return false;
- } else if (!loginName.equals(other.loginName))
- return false;
- if (penName == null) {
- if (other.penName != null)
- return false;
- } else if (!penName.equals(other.penName))
- return false;
- if (personId == null) {
- if (other.personId != null)
- return false;
- } else if (!personId.equals(other.personId))
- return false;
- if (status != other.status)
- return false;
- return true;
- }
-
- @Override
- public String toString() {
- return "BigPerson [personId=" + personId + ", loginName=" + loginName + ", status="
- + status + ", email=" + email + ", penName=" + penName + ", infoProfile="
- + infoProfile + "]";
- }
-
-}
\ No newline at end of file
diff --git a/dubbo-serialization/dubbo-serialization-jdk/src/test/java/org/apache/dubbo/common/model/person/FullAddress.java b/dubbo-serialization/dubbo-serialization-jdk/src/test/java/org/apache/dubbo/common/model/person/FullAddress.java
deleted file mode 100644
index 3892167..0000000
--- a/dubbo-serialization/dubbo-serialization-jdk/src/test/java/org/apache/dubbo/common/model/person/FullAddress.java
+++ /dev/null
@@ -1,202 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.dubbo.common.model.person;
-
-import java.io.Serializable;
-
-public class FullAddress implements Serializable {
-
- private static final long serialVersionUID = 5163979984269419831L;
-
- private String countryId;
-
- private String countryName;
-
- private String provinceName;
-
- private String cityId;
-
- private String cityName;
-
- private String streetAddress;
-
- private String zipCode;
-
- public FullAddress() {
- }
-
- public FullAddress(String countryId, String provinceName, String cityId, String streetAddress,
- String zipCode) {
- this.countryId = countryId;
- this.countryName = countryId;
- this.provinceName = provinceName;
- this.cityId = cityId;
- this.cityName = cityId;
- this.streetAddress = streetAddress;
- this.zipCode = zipCode;
- }
-
- public FullAddress(String countryId, String countryName, String provinceName, String cityId,
- String cityName, String streetAddress, String zipCode) {
- this.countryId = countryId;
- this.countryName = countryName;
- this.provinceName = provinceName;
- this.cityId = cityId;
- this.cityName = cityName;
- this.streetAddress = streetAddress;
- this.zipCode = zipCode;
- }
-
- public String getCountryId() {
- return countryId;
- }
-
- public void setCountryId(String countryId) {
- this.countryId = countryId;
- }
-
- public String getCountryName() {
- return countryName;
- }
-
- public void setCountryName(String countryName) {
- this.countryName = countryName;
- }
-
- public String getProvinceName() {
- return provinceName;
- }
-
- public void setProvinceName(String provinceName) {
- this.provinceName = provinceName;
- }
-
- public String getCityId() {
- return cityId;
- }
-
- public void setCityId(String cityId) {
- this.cityId = cityId;
- }
-
- public String getCityName() {
- return cityName;
- }
-
- public void setCityName(String cityName) {
- this.cityName = cityName;
- }
-
- public String getStreetAddress() {
- return streetAddress;
- }
-
- public void setStreetAddress(String streetAddress) {
- this.streetAddress = streetAddress;
- }
-
- public String getZipCode() {
- return zipCode;
- }
-
- public void setZipCode(String zipCode) {
- this.zipCode = zipCode;
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + ((cityId == null) ? 0 : cityId.hashCode());
- result = prime * result + ((cityName == null) ? 0 : cityName.hashCode());
- result = prime * result + ((countryId == null) ? 0 : countryId.hashCode());
- result = prime * result + ((countryName == null) ? 0 : countryName.hashCode());
- result = prime * result + ((provinceName == null) ? 0 : provinceName.hashCode());
- result = prime * result + ((streetAddress == null) ? 0 : streetAddress.hashCode());
- result = prime * result + ((zipCode == null) ? 0 : zipCode.hashCode());
- return result;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj)
- return true;
- if (obj == null)
- return false;
- if (getClass() != obj.getClass())
- return false;
- FullAddress other = (FullAddress) obj;
- if (cityId == null) {
- if (other.cityId != null)
- return false;
- } else if (!cityId.equals(other.cityId))
- return false;
- if (cityName == null) {
- if (other.cityName != null)
- return false;
- } else if (!cityName.equals(other.cityName))
- return false;
- if (countryId == null) {
- if (other.countryId != null)
- return false;
- } else if (!countryId.equals(other.countryId))
- return false;
- if (countryName == null) {
- if (other.countryName != null)
- return false;
- } else if (!countryName.equals(other.countryName))
- return false;
- if (provinceName == null) {
- if (other.provinceName != null)
- return false;
- } else if (!provinceName.equals(other.provinceName))
- return false;
- if (streetAddress == null) {
- if (other.streetAddress != null)
- return false;
- } else if (!streetAddress.equals(other.streetAddress))
- return false;
- if (zipCode == null) {
- if (other.zipCode != null)
- return false;
- } else if (!zipCode.equals(other.zipCode))
- return false;
- return true;
- }
-
- @Override
- public String toString() {
- StringBuilder sb = new StringBuilder();
- if (countryName != null && countryName.length() > 0) {
- sb.append(countryName);
- }
- if (provinceName != null && provinceName.length() > 0) {
- sb.append(" ");
- sb.append(provinceName);
- }
- if (cityName != null && cityName.length() > 0) {
- sb.append(" ");
- sb.append(cityName);
- }
- if (streetAddress != null && streetAddress.length() > 0) {
- sb.append(" ");
- sb.append(streetAddress);
- }
- return sb.toString();
- }
-
-}
\ No newline at end of file
diff --git a/dubbo-serialization/dubbo-serialization-jdk/src/test/java/org/apache/dubbo/common/model/person/PersonInfo.java b/dubbo-serialization/dubbo-serialization-jdk/src/test/java/org/apache/dubbo/common/model/person/PersonInfo.java
deleted file mode 100644
index 15f1238..0000000
--- a/dubbo-serialization/dubbo-serialization-jdk/src/test/java/org/apache/dubbo/common/model/person/PersonInfo.java
+++ /dev/null
@@ -1,206 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.dubbo.common.model.person;
-
-import java.io.Serializable;
-import java.util.List;
-
-public class PersonInfo implements Serializable {
- private static final long serialVersionUID = 7443011149612231882L;
-
- List<Phone> phones;
-
- Phone fax;
-
- FullAddress fullAddress;
-
- String mobileNo;
-
- String name;
-
- boolean male;
-
- boolean female;
-
- String department;
-
- String jobTitle;
-
- String homepageUrl;
-
- public List<Phone> getPhones() {
- return phones;
- }
-
- public void setPhones(List<Phone> phones) {
- this.phones = phones;
- }
-
- public boolean isMale() {
- return male;
- }
-
- public void setMale(boolean male) {
- this.male = male;
- }
-
- public boolean isFemale() {
- return female;
- }
-
- public void setFemale(boolean female) {
- this.female = female;
- }
-
- public String getDepartment() {
- return department;
- }
-
- public void setDepartment(String department) {
- this.department = department;
- }
-
- public Phone getFax() {
- return fax;
- }
-
- public void setFax(Phone fax) {
- this.fax = fax;
- }
-
- public FullAddress getFullAddress() {
- return fullAddress;
- }
-
- public void setFullAddress(FullAddress fullAddress) {
- this.fullAddress = fullAddress;
- }
-
- public String getHomepageUrl() {
- return homepageUrl;
- }
-
- public void setHomepageUrl(String homepageUrl) {
- this.homepageUrl = homepageUrl;
- }
-
- public String getJobTitle() {
- return jobTitle;
- }
-
- public void setJobTitle(String jobTitle) {
- this.jobTitle = jobTitle;
- }
-
- public String getMobileNo() {
- return mobileNo;
- }
-
- public void setMobileNo(String mobileNo) {
- this.mobileNo = mobileNo;
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + ((department == null) ? 0 : department.hashCode());
- result = prime * result + ((fax == null) ? 0 : fax.hashCode());
- result = prime * result + (female ? 1231 : 1237);
- result = prime * result + ((fullAddress == null) ? 0 : fullAddress.hashCode());
- result = prime * result + ((homepageUrl == null) ? 0 : homepageUrl.hashCode());
- result = prime * result + ((jobTitle == null) ? 0 : jobTitle.hashCode());
- result = prime * result + (male ? 1231 : 1237);
- result = prime * result + ((mobileNo == null) ? 0 : mobileNo.hashCode());
- result = prime * result + ((name == null) ? 0 : name.hashCode());
- result = prime * result + ((phones == null) ? 0 : phones.hashCode());
- return result;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj)
- return true;
- if (obj == null)
- return false;
- if (getClass() != obj.getClass())
- return false;
- PersonInfo other = (PersonInfo) obj;
- if (department == null) {
- if (other.department != null)
- return false;
- } else if (!department.equals(other.department))
- return false;
- if (fax == null) {
- if (other.fax != null)
- return false;
- } else if (!fax.equals(other.fax))
- return false;
- if (female != other.female)
- return false;
- if (fullAddress == null) {
- if (other.fullAddress != null)
- return false;
- } else if (!fullAddress.equals(other.fullAddress))
- return false;
- if (homepageUrl == null) {
- if (other.homepageUrl != null)
- return false;
- } else if (!homepageUrl.equals(other.homepageUrl))
- return false;
- if (jobTitle == null) {
- if (other.jobTitle != null)
- return false;
- } else if (!jobTitle.equals(other.jobTitle))
- return false;
- if (male != other.male)
- return false;
- if (mobileNo == null) {
- if (other.mobileNo != null)
- return false;
- } else if (!mobileNo.equals(other.mobileNo))
- return false;
- if (name == null) {
- if (other.name != null)
- return false;
- } else if (!name.equals(other.name))
- return false;
- if (phones == null) {
- if (other.phones != null)
- return false;
- } else if (!phones.equals(other.phones))
- return false;
- return true;
- }
-
- @Override
- public String toString() {
- return "PersonInfo [phones=" + phones + ", fax=" + fax + ", fullAddress=" + fullAddress
- + ", mobileNo=" + mobileNo + ", name=" + name + ", male=" + male + ", female="
- + female + ", department=" + department + ", jobTitle=" + jobTitle
- + ", homepageUrl=" + homepageUrl + "]";
- }
-
-}
diff --git a/dubbo-serialization/dubbo-serialization-jdk/src/test/java/org/apache/dubbo/common/model/person/PersonStatus.java b/dubbo-serialization/dubbo-serialization-jdk/src/test/java/org/apache/dubbo/common/model/person/PersonStatus.java
deleted file mode 100644
index 62869c2..0000000
--- a/dubbo-serialization/dubbo-serialization-jdk/src/test/java/org/apache/dubbo/common/model/person/PersonStatus.java
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.dubbo.common.model.person;
-
-public enum PersonStatus {
- ENABLED,
- DISABLED
-}
\ No newline at end of file
diff --git a/dubbo-serialization/dubbo-serialization-jdk/src/test/java/org/apache/dubbo/common/model/person/Phone.java b/dubbo-serialization/dubbo-serialization-jdk/src/test/java/org/apache/dubbo/common/model/person/Phone.java
deleted file mode 100644
index 41fd38a..0000000
--- a/dubbo-serialization/dubbo-serialization-jdk/src/test/java/org/apache/dubbo/common/model/person/Phone.java
+++ /dev/null
@@ -1,139 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.dubbo.common.model.person;
-
-import java.io.Serializable;
-
-public class Phone implements Serializable {
-
- private static final long serialVersionUID = 4399060521859707703L;
-
- private String country;
-
- private String area;
-
- private String number;
-
- private String extensionNumber;
-
- public Phone() {
- }
-
- public Phone(String country, String area, String number, String extensionNumber) {
- this.country = country;
- this.area = area;
- this.number = number;
- this.extensionNumber = extensionNumber;
- }
-
- public String getCountry() {
- return country;
- }
-
- public void setCountry(String country) {
- this.country = country;
- }
-
- public String getArea() {
- return area;
- }
-
- public void setArea(String area) {
- this.area = area;
- }
-
- public String getNumber() {
- return number;
- }
-
- public void setNumber(String number) {
- this.number = number;
- }
-
- public String getExtensionNumber() {
- return extensionNumber;
- }
-
- public void setExtensionNumber(String extensionNumber) {
- this.extensionNumber = extensionNumber;
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + ((area == null) ? 0 : area.hashCode());
- result = prime * result + ((country == null) ? 0 : country.hashCode());
- result = prime * result + ((extensionNumber == null) ? 0 : extensionNumber.hashCode());
- result = prime * result + ((number == null) ? 0 : number.hashCode());
- return result;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj)
- return true;
- if (obj == null)
- return false;
- if (getClass() != obj.getClass())
- return false;
- Phone other = (Phone) obj;
- if (area == null) {
- if (other.area != null)
- return false;
- } else if (!area.equals(other.area))
- return false;
- if (country == null) {
- if (other.country != null)
- return false;
- } else if (!country.equals(other.country))
- return false;
- if (extensionNumber == null) {
- if (other.extensionNumber != null)
- return false;
- } else if (!extensionNumber.equals(other.extensionNumber))
- return false;
- if (number == null) {
- if (other.number != null)
- return false;
- } else if (!number.equals(other.number))
- return false;
- return true;
- }
-
- @Override
- public String toString() {
- StringBuilder sb = new StringBuilder();
- if (country != null && country.length() > 0) {
- sb.append(country);
- sb.append("-");
- }
- if (area != null && area.length() > 0) {
- sb.append(area);
- sb.append("-");
- }
- if (number != null && number.length() > 0) {
- sb.append(number);
- }
- if (extensionNumber != null && extensionNumber.length() > 0) {
- sb.append("-");
- sb.append(extensionNumber);
- }
- return sb.toString();
- }
-
-}
\ No newline at end of file
diff --git a/dubbo-serialization/dubbo-serialization-jdk/src/test/java/org/apache/dubbo/common/serialize/serialization/AbstractSerializationPersonOkTest.java b/dubbo-serialization/dubbo-serialization-jdk/src/test/java/org/apache/dubbo/common/serialize/serialization/AbstractSerializationPersonOkTest.java
deleted file mode 100644
index 03395cb..0000000
--- a/dubbo-serialization/dubbo-serialization-jdk/src/test/java/org/apache/dubbo/common/serialize/serialization/AbstractSerializationPersonOkTest.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.dubbo.common.serialize.serialization;
-
-import org.apache.dubbo.common.model.Person;
-
-import org.junit.Test;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-public abstract class AbstractSerializationPersonOkTest extends AbstractSerializationTest {
- @Test
- public void test_Person() throws Exception {
- assertObject(new Person());
- }
-
- @Test
- public void test_Person_withType() throws Exception {
- assertObjectWithType(new Person(), Person.class);
- }
-
- @Test
- public void test_PersonList() throws Exception {
- List<Person> args = new ArrayList<Person>();
- args.add(new Person());
-
- assertObject(args);
- }
-
- @Test
- public void test_PersonSet() throws Exception {
- Set<Person> args = new HashSet<Person>();
- args.add(new Person());
-
- assertObject(args);
- }
-
- @Test
- public void test_IntPersonMap() throws Exception {
- Map<Integer, Person> args = new HashMap<Integer, Person>();
- args.put(1, new Person());
-
- assertObject(args);
- }
-
- @Test
- public void test_StringPersonMap() throws Exception {
- Map<String, Person> args = new HashMap<String, Person>();
- args.put("1", new Person());
-
- assertObject(args);
- }
-
- @Test
- public void test_StringPersonListMap() throws Exception {
- Map<String, List<Person>> args = new HashMap<String, List<Person>>();
-
- List<Person> sublist = new ArrayList<Person>();
- sublist.add(new Person());
- args.put("1", sublist);
-
- assertObject(args);
- }
-
- @Test
- public void test_PersonListList() throws Exception {
- List<List<Person>> args = new ArrayList<List<Person>>();
- List<Person> sublist = new ArrayList<Person>();
- sublist.add(new Person());
- args.add(sublist);
-
- assertObject(args);
- }
-}
\ No newline at end of file
diff --git a/dubbo-serialization/dubbo-serialization-jdk/src/test/java/org/apache/dubbo/common/serialize/serialization/AbstractSerializationTest.java b/dubbo-serialization/dubbo-serialization-jdk/src/test/java/org/apache/dubbo/common/serialize/serialization/AbstractSerializationTest.java
deleted file mode 100644
index a40e378..0000000
--- a/dubbo-serialization/dubbo-serialization-jdk/src/test/java/org/apache/dubbo/common/serialize/serialization/AbstractSerializationTest.java
+++ /dev/null
@@ -1,1210 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.dubbo.common.serialize.serialization;
-
-import org.apache.dubbo.common.URL;
-import org.apache.dubbo.common.model.AnimalEnum;
-import org.apache.dubbo.common.model.BizException;
-import org.apache.dubbo.common.model.BizExceptionNoDefaultConstructor;
-import org.apache.dubbo.common.model.SerializablePerson;
-import org.apache.dubbo.common.model.media.Image;
-import org.apache.dubbo.common.model.media.Image.Size;
-import org.apache.dubbo.common.model.media.Media;
-import org.apache.dubbo.common.model.media.Media.Player;
-import org.apache.dubbo.common.model.media.MediaContent;
-import org.apache.dubbo.common.model.person.BigPerson;
-import org.apache.dubbo.common.model.person.FullAddress;
-import org.apache.dubbo.common.model.person.PersonInfo;
-import org.apache.dubbo.common.model.person.PersonStatus;
-import org.apache.dubbo.common.model.person.Phone;
-import org.apache.dubbo.common.serialize.ObjectInput;
-import org.apache.dubbo.common.serialize.ObjectOutput;
-import org.apache.dubbo.common.serialize.Serialization;
-
-import org.junit.Test;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.math.BigDecimal;
-import java.math.BigInteger;
-import java.sql.Time;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Random;
-import java.util.Set;
-
-import static org.junit.Assert.assertArrayEquals;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertSame;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-
-public abstract class AbstractSerializationTest {
- static Random random = new Random();
- Serialization serialization;
- URL url = new URL("protocol", "1.1.1.1", 1234);
- ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
-
- // ================ Primitive Type ================
- BigPerson bigPerson;
- MediaContent mediaContent;
-
- {
- bigPerson = new BigPerson();
- bigPerson.setPersonId("superman111");
- bigPerson.setLoginName("superman");
- bigPerson.setStatus(PersonStatus.ENABLED);
- bigPerson.setEmail("sm@1.com");
- bigPerson.setPenName("pname");
-
- ArrayList<Phone> phones = new ArrayList<Phone>();
- Phone phone1 = new Phone("86", "0571", "87654321", "001");
- Phone phone2 = new Phone("86", "0571", "87654322", "002");
- phones.add(phone1);
- phones.add(phone2);
-
- PersonInfo pi = new PersonInfo();
- pi.setPhones(phones);
- Phone fax = new Phone("86", "0571", "87654321", null);
- pi.setFax(fax);
- FullAddress addr = new FullAddress("CN", "zj", "3480", "wensanlu", "315000");
- pi.setFullAddress(addr);
- pi.setMobileNo("13584652131");
- pi.setMale(true);
- pi.setDepartment("b2b");
- pi.setHomepageUrl("www.capcom.com");
- pi.setJobTitle("qa");
- pi.setName("superman");
-
- bigPerson.setInfoProfile(pi);
- }
-
- {
- Media media = new Media();
- media.setUri("uri://中华人民共和国");
- media.setTitle("title");
- media.setWidth(1239);
- media.setHeight(1938);
- media.setFormat("format-xxxx");
- media.setDuration(93419235);
- media.setSize(3477897);
- media.setBitrate(94523);
- List<String> persons = new ArrayList<String>();
- persons.add("jerry");
- persons.add("tom");
- persons.add("lucy");
- media.setPersons(persons);
- media.setCopyright("1999-2011");
- media.setPlayer(Player.FLASH);
-
- List<Image> images = new ArrayList<Image>();
- for (int i = 0; i < 10; ++i) {
- Image image = new Image();
- image.setUri("url" + i);
- if (i % 2 == 0) image.setTitle("title" + i);
- image.setWidth(34 + i);
- image.setHeight(2323 + i);
- image.setSize((i % 2 == 0) ? Size.SMALL : Size.LARGE);
-
- images.add(image);
- }
-
- mediaContent = new MediaContent(media, images);
- }
-
- @Test
- public void test_Bool() throws Exception {
- ObjectOutput objectOutput = serialization.serialize(url, byteArrayOutputStream);
- objectOutput.writeBool(false);
- objectOutput.flushBuffer();
-
- ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(
- byteArrayOutputStream.toByteArray());
- ObjectInput deserialize = serialization.deserialize(url, byteArrayInputStream);
-
- assertFalse(deserialize.readBool());
-
- try {
- deserialize.readBool();
- fail();
- } catch (IOException expected) {
- }
- }
-
- @Test
- public void test_Bool_Multi() throws Exception {
- boolean[] array = new boolean[100];
- for (int i = 0; i < array.length; i++) {
- array[i] = random.nextBoolean();
- }
-
- ObjectOutput objectOutput = serialization.serialize(url, byteArrayOutputStream);
- for (boolean b : array) {
- objectOutput.writeBool(b);
- }
- objectOutput.flushBuffer();
-
- ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(
- byteArrayOutputStream.toByteArray());
- ObjectInput deserialize = serialization.deserialize(url, byteArrayInputStream);
-
- for (boolean b : array) {
- assertEquals(b, deserialize.readBool());
- }
-
- try {
- deserialize.readBool();
- fail();
- } catch (IOException expected) {
- }
- }
-
- @Test
- public void test_Byte() throws Exception {
- ObjectOutput objectOutput = serialization.serialize(url, byteArrayOutputStream);
- objectOutput.writeByte((byte) 123);
- objectOutput.flushBuffer();
-
- ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(
- byteArrayOutputStream.toByteArray());
- ObjectInput deserialize = serialization.deserialize(url, byteArrayInputStream);
-
- assertEquals((byte) 123, deserialize.readByte());
-
- try {
- deserialize.readByte();
- fail();
- } catch (IOException expected) {
- }
- }
-
- @Test
- public void test_Byte_Multi() throws Exception {
- byte[] array = new byte[100];
- random.nextBytes(array);
-
- ObjectOutput objectOutput = serialization.serialize(url, byteArrayOutputStream);
- for (byte b : array) {
- objectOutput.writeByte(b);
- }
- objectOutput.flushBuffer();
-
- ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(
- byteArrayOutputStream.toByteArray());
- ObjectInput deserialize = serialization.deserialize(url, byteArrayInputStream);
-
- for (byte b : array) {
- assertEquals(b, deserialize.readByte());
- }
-
- try {
- deserialize.readByte();
- fail();
- } catch (IOException expected) {
- }
- }
-
- @Test
- public void test_Short() throws Exception {
- ObjectOutput objectOutput = serialization.serialize(url, byteArrayOutputStream);
- objectOutput.writeShort((short) 123);
- objectOutput.flushBuffer();
-
- ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(
- byteArrayOutputStream.toByteArray());
- ObjectInput deserialize = serialization.deserialize(url, byteArrayInputStream);
-
- assertEquals((short) 123, deserialize.readShort());
-
- try {
- deserialize.readShort();
- fail();
- } catch (IOException expected) {
- }
- }
-
- @Test
- public void test_Integer() throws Exception {
- ObjectOutput objectOutput = serialization.serialize(url, byteArrayOutputStream);
- objectOutput.writeInt(1);
- objectOutput.flushBuffer();
-
- ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(
- byteArrayOutputStream.toByteArray());
- ObjectInput deserialize = serialization.deserialize(url, byteArrayInputStream);
-
- int i = deserialize.readInt();
- assertEquals(1, i);
-
- try {
- deserialize.readInt();
- fail();
- } catch (IOException expected) {
- }
- }
-
- @Test
- public void test_Long() throws Exception {
- ObjectOutput objectOutput = serialization.serialize(url, byteArrayOutputStream);
- objectOutput.writeLong(123L);
- objectOutput.flushBuffer();
-
- ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(
- byteArrayOutputStream.toByteArray());
- ObjectInput deserialize = serialization.deserialize(url, byteArrayInputStream);
-
- assertEquals(123L, deserialize.readLong());
-
- try {
- deserialize.readLong();
- fail();
- } catch (IOException expected) {
- }
- }
-
- @Test
- public void test_Float() throws Exception {
- ObjectOutput objectOutput = serialization.serialize(url, byteArrayOutputStream);
- objectOutput.writeFloat(1.28F);
- objectOutput.flushBuffer();
-
- ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(
- byteArrayOutputStream.toByteArray());
- ObjectInput deserialize = serialization.deserialize(url, byteArrayInputStream);
-
- assertTrue(1.28F == deserialize.readFloat());
-
- try {
- deserialize.readFloat();
- fail();
- } catch (IOException expected) {
- }
- }
-
- // ================== Util methods ==================
-
- @Test
- public void test_Double() throws Exception {
- ObjectOutput objectOutput = serialization.serialize(url, byteArrayOutputStream);
- objectOutput.writeDouble(1.28);
- objectOutput.flushBuffer();
-
- ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(
- byteArrayOutputStream.toByteArray());
- ObjectInput deserialize = serialization.deserialize(url, byteArrayInputStream);
-
- assertTrue(1.28 == deserialize.readDouble());
-
- try {
- deserialize.readDouble();
- fail();
- } catch (IOException expected) {
- }
- }
-
- @Test
- public void test_UtfString() throws Exception {
- ObjectOutput objectOutput = serialization.serialize(url, byteArrayOutputStream);
- objectOutput.writeUTF("123中华人民共和国");
- objectOutput.flushBuffer();
-
- ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(
- byteArrayOutputStream.toByteArray());
- ObjectInput deserialize = serialization.deserialize(url, byteArrayInputStream);
-
- assertEquals("123中华人民共和国", deserialize.readUTF());
-
- try {
- deserialize.readUTF();
- fail();
- } catch (IOException expected) {
- }
- }
-
- @Test
- public void test_Bytes() throws Exception {
- ObjectOutput objectOutput = serialization.serialize(url, byteArrayOutputStream);
- objectOutput.writeBytes("123中华人民共和国".getBytes());
- objectOutput.flushBuffer();
-
- ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(
- byteArrayOutputStream.toByteArray());
- ObjectInput deserialize = serialization.deserialize(url, byteArrayInputStream);
-
- assertArrayEquals("123中华人民共和国".getBytes(), deserialize.readBytes());
-
- try {
- deserialize.readBytes();
- fail();
- } catch (IOException expected) {
- }
- }
-
- @Test
- public void test_BytesRange() throws Exception {
- ObjectOutput objectOutput = serialization.serialize(url, byteArrayOutputStream);
- objectOutput.writeBytes("123中华人民共和国-新疆维吾尔自治区".getBytes(), 1, 9);
- objectOutput.flushBuffer();
-
- ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(
- byteArrayOutputStream.toByteArray());
- ObjectInput deserialize = serialization.deserialize(url, byteArrayInputStream);
-
- byte[] expectedArray = new byte[9];
- System.arraycopy("123中华人民共和国-新疆维吾尔自治区".getBytes(), 1, expectedArray, 0, expectedArray.length);
- assertArrayEquals(expectedArray, deserialize.readBytes());
-
- try {
- deserialize.readBytes();
- fail();
- } catch (IOException expected) {
- }
- }
-
- // ================ Array Type ================
-
- <T> void assertObjectArray(T[] data, Class<T[]> clazz) throws Exception {
- ObjectOutput objectOutput = serialization.serialize(url, byteArrayOutputStream);
- objectOutput.writeObject(data);
- objectOutput.flushBuffer();
-
- ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(
- byteArrayOutputStream.toByteArray());
- ObjectInput deserialize = serialization.deserialize(url, byteArrayInputStream);
-
- assertArrayEquals(data, clazz.cast(deserialize.readObject()));
-
- try {
- deserialize.readObject();
- fail();
- } catch (IOException expected) {
- }
- }
-
- <T> void assertObjectArrayWithType(T[] data, Class<T[]> clazz) throws Exception {
- ObjectOutput objectOutput = serialization.serialize(url, byteArrayOutputStream);
- objectOutput.writeObject(data);
- objectOutput.flushBuffer();
-
- ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(
- byteArrayOutputStream.toByteArray());
- ObjectInput deserialize = serialization.deserialize(url, byteArrayInputStream);
-
- assertArrayEquals(data, clazz.cast(deserialize.readObject(clazz)));
-
- try {
- deserialize.readObject(clazz);
- fail();
- } catch (IOException expected) {
- }
- }
-
- @SuppressWarnings("unchecked")
- <T> void assertObject(T data) throws Exception {
- ObjectOutput objectOutput = serialization.serialize(url, byteArrayOutputStream);
- objectOutput.writeObject(data);
- objectOutput.flushBuffer();
-
- ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(
- byteArrayOutputStream.toByteArray());
- ObjectInput deserialize = serialization.deserialize(url, byteArrayInputStream);
-
- assertEquals(data, (T) deserialize.readObject());
-
- try {
- deserialize.readObject();
- fail();
- } catch (IOException expected) {
- }
- }
-
- <T> void assertObjectWithType(T data, Class<T> clazz) throws Exception {
- ObjectOutput objectOutput = serialization.serialize(url, byteArrayOutputStream);
- objectOutput.writeObject(data);
- objectOutput.flushBuffer();
-
- ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(
- byteArrayOutputStream.toByteArray());
- ObjectInput deserialize = serialization.deserialize(url, byteArrayInputStream);
-
- assertEquals(data, (T) deserialize.readObject(clazz));
-
- try {
- deserialize.readObject(clazz);
- fail();
- } catch (IOException expected) {
- }
- }
-
- @Test
- public void test_boolArray() throws Exception {
- boolean[] data = new boolean[]{true, false, true};
-
- ObjectOutput objectOutput = serialization.serialize(url, byteArrayOutputStream);
- objectOutput.writeObject(data);
- objectOutput.flushBuffer();
-
- ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(
- byteArrayOutputStream.toByteArray());
- ObjectInput deserialize = serialization.deserialize(url, byteArrayInputStream);
-
- assertTrue(Arrays.equals(data, (boolean[]) deserialize.readObject()));
-
- try {
- deserialize.readObject();
- fail();
- } catch (IOException expected) {
- }
- }
-
- @Test
- public void test_boolArray_withType() throws Exception {
- boolean[] data = new boolean[]{true, false, true};
-
- ObjectOutput objectOutput = serialization.serialize(url, byteArrayOutputStream);
- objectOutput.writeObject(data);
- objectOutput.flushBuffer();
-
- ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(
- byteArrayOutputStream.toByteArray());
- ObjectInput deserialize = serialization.deserialize(url, byteArrayInputStream);
-
- assertTrue(Arrays.equals(data, (boolean[]) deserialize.readObject(boolean[].class)));
-
- try {
- deserialize.readObject(boolean[].class);
- fail();
- } catch (IOException expected) {
- }
- }
-
- @Test
- public void test_charArray() throws Exception {
- char[] data = new char[]{'a', '中', '无'};
-
- ObjectOutput objectOutput = serialization.serialize(url, byteArrayOutputStream);
- objectOutput.writeObject(data);
- objectOutput.flushBuffer();
-
- ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(
- byteArrayOutputStream.toByteArray());
- ObjectInput deserialize = serialization.deserialize(url, byteArrayInputStream);
-
- assertArrayEquals(data, (char[]) deserialize.readObject());
-
- try {
- deserialize.readObject();
- fail();
- } catch (IOException expected) {
- }
- }
-
- @Test
- public void test_charArray_withType() throws Exception {
- char[] data = new char[]{'a', '中', '无'};
-
- ObjectOutput objectOutput = serialization.serialize(url, byteArrayOutputStream);
- objectOutput.writeObject(data);
- objectOutput.flushBuffer();
-
- ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(
- byteArrayOutputStream.toByteArray());
- ObjectInput deserialize = serialization.deserialize(url, byteArrayInputStream);
-
- assertArrayEquals(data, (char[]) deserialize.readObject(char[].class));
-
- try {
- deserialize.readObject(char[].class);
- fail();
- } catch (IOException expected) {
- }
- }
-
- @Test
- public void test_shortArray() throws Exception {
- short[] data = new short[]{37, 39, 12};
-
- ObjectOutput objectOutput = serialization.serialize(url, byteArrayOutputStream);
- objectOutput.writeObject(data);
- objectOutput.flushBuffer();
-
- ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(
- byteArrayOutputStream.toByteArray());
- ObjectInput deserialize = serialization.deserialize(url, byteArrayInputStream);
-
- assertArrayEquals(data, (short[]) deserialize.readObject());
-
- try {
- deserialize.readObject();
- fail();
- } catch (IOException expected) {
- }
- }
-
- @Test
- public void test_shortArray_withType() throws Exception {
- short[] data = new short[]{37, 39, 12};
-
- ObjectOutput objectOutput = serialization.serialize(url, byteArrayOutputStream);
- objectOutput.writeObject(data);
- objectOutput.flushBuffer();
-
- ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(
- byteArrayOutputStream.toByteArray());
- ObjectInput deserialize = serialization.deserialize(url, byteArrayInputStream);
-
- assertArrayEquals(data, (short[]) deserialize.readObject(short[].class));
-
- try {
- deserialize.readObject(short[].class);
- fail();
- } catch (IOException expected) {
- }
- }
-
- @Test
- public void test_intArray() throws Exception {
- int[] data = new int[]{234, 0, -1};
-
- ObjectOutput objectOutput = serialization.serialize(url, byteArrayOutputStream);
- objectOutput.writeObject(data);
- objectOutput.flushBuffer();
-
- ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(
- byteArrayOutputStream.toByteArray());
- ObjectInput deserialize = serialization.deserialize(url, byteArrayInputStream);
-
- assertArrayEquals(data, (int[]) deserialize.readObject());
-
- try {
- deserialize.readObject();
- fail();
- } catch (IOException expected) {
- }
- }
-
- @Test
- public void test_intArray_withType() throws Exception {
- int[] data = new int[]{234, 0, -1};
-
- ObjectOutput objectOutput = serialization.serialize(url, byteArrayOutputStream);
- objectOutput.writeObject(data);
- objectOutput.flushBuffer();
-
- ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(
- byteArrayOutputStream.toByteArray());
- ObjectInput deserialize = serialization.deserialize(url, byteArrayInputStream);
-
- assertArrayEquals(data, (int[]) deserialize.readObject(int[].class));
-
- try {
- deserialize.readObject(int[].class);
- fail();
- } catch (IOException expected) {
- }
- }
-
- @Test
- public void test_longArray() throws Exception {
- long[] data = new long[]{234, 0, -1};
-
- ObjectOutput objectOutput = serialization.serialize(url, byteArrayOutputStream);
- objectOutput.writeObject(data);
- objectOutput.flushBuffer();
-
- ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(
- byteArrayOutputStream.toByteArray());
- ObjectInput deserialize = serialization.deserialize(url, byteArrayInputStream);
-
- assertArrayEquals(data, (long[]) deserialize.readObject());
-
- try {
- deserialize.readObject();
- fail();
- } catch (IOException expected) {
- }
- }
-
- @Test
- public void test_longArray_withType() throws Exception {
- long[] data = new long[]{234, 0, -1};
-
- ObjectOutput objectOutput = serialization.serialize(url, byteArrayOutputStream);
- objectOutput.writeObject(data);
- objectOutput.flushBuffer();
-
- ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(
- byteArrayOutputStream.toByteArray());
- ObjectInput deserialize = serialization.deserialize(url, byteArrayInputStream);
-
- assertArrayEquals(data, (long[]) deserialize.readObject(long[].class));
-
- try {
- deserialize.readObject(long[].class);
- fail();
- } catch (IOException expected) {
- }
- }
-
- @Test
- public void test_floatArray() throws Exception {
- float[] data = new float[]{37F, -3.14F, 123456.7F};
-
- ObjectOutput objectOutput = serialization.serialize(url, byteArrayOutputStream);
- objectOutput.writeObject(data);
- objectOutput.flushBuffer();
-
- ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(
- byteArrayOutputStream.toByteArray());
- ObjectInput deserialize = serialization.deserialize(url, byteArrayInputStream);
-
- assertArrayEquals(data, (float[]) deserialize.readObject(), 0.0001F);
-
- try {
- deserialize.readObject();
- fail();
- } catch (IOException expected) {
- }
- }
-
- @Test
- public void test_floatArray_withType() throws Exception {
- float[] data = new float[]{37F, -3.14F, 123456.7F};
-
- ObjectOutput objectOutput = serialization.serialize(url, byteArrayOutputStream);
- objectOutput.writeObject(data);
- objectOutput.flushBuffer();
-
- ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(
- byteArrayOutputStream.toByteArray());
- ObjectInput deserialize = serialization.deserialize(url, byteArrayInputStream);
-
- assertArrayEquals(data, (float[]) deserialize.readObject(float[].class), 0.0001F);
-
- try {
- deserialize.readObject(float[].class);
- fail();
- } catch (IOException expected) {
- }
- }
-
- @Test
- public void test_doubleArray() throws Exception {
- double[] data = new double[]{37D, -3.14D, 123456.7D};
-
- ObjectOutput objectOutput = serialization.serialize(url, byteArrayOutputStream);
- objectOutput.writeObject(data);
- objectOutput.flushBuffer();
-
- ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(
- byteArrayOutputStream.toByteArray());
- ObjectInput deserialize = serialization.deserialize(url, byteArrayInputStream);
-
- assertArrayEquals(data, (double[]) deserialize.readObject(), 0.0001);
-
- try {
- deserialize.readObject();
- fail();
- } catch (IOException expected) {
- }
- }
-
- @Test
- public void test_doubleArray_withType() throws Exception {
- double[] data = new double[]{37D, -3.14D, 123456.7D};
-
- ObjectOutput objectOutput = serialization.serialize(url, byteArrayOutputStream);
- objectOutput.writeObject(data);
- objectOutput.flushBuffer();
-
- ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(
- byteArrayOutputStream.toByteArray());
- ObjectInput deserialize = serialization.deserialize(url, byteArrayInputStream);
-
- assertArrayEquals(data, (double[]) deserialize.readObject(double[].class), 0.0001);
-
- try {
- deserialize.readObject(double[].class);
- fail();
- } catch (IOException expected) {
- }
- }
-
- @Test
- public void test_StringArray() throws Exception {
- assertObjectArray(new String[]{"1", "b"}, String[].class);
- }
-
- @Test
- public void test_StringArray_withType() throws Exception {
- assertObjectArrayWithType(new String[]{"1", "b"}, String[].class);
- }
-
- // ================ Simple Type ================
-
- @Test
- public void test_IntegerArray() throws Exception {
- assertObjectArray(new Integer[]{234, 0, -1}, Integer[].class);
- }
-
- @Test
- public void test_IntegerArray_withType() throws Exception {
- assertObjectArrayWithType(new Integer[]{234, 0, -1}, Integer[].class);
- }
-
- @Test
- public void test_EnumArray() throws Exception {
- assertObjectArray(new AnimalEnum[]{AnimalEnum.bull, AnimalEnum.cat, AnimalEnum.dog, AnimalEnum.horse}, AnimalEnum[].class);
- }
-
- @Test
- public void test_EnumArray_withType() throws Exception {
- assertObjectArrayWithType(new AnimalEnum[]{AnimalEnum.bull, AnimalEnum.cat, AnimalEnum.dog, AnimalEnum.horse}, AnimalEnum[].class);
- }
-
- @Test
- public void test_SPerson() throws Exception {
- assertObject(new SerializablePerson());
- }
-
- @Test
- public void test_SPerson_withType() throws Exception {
- assertObjectWithType(new SerializablePerson(), SerializablePerson.class);
- }
-
- @Test
- public void test_BizException() throws Exception {
- BizException e = new BizException("Hello");
-
- ObjectOutput objectOutput = serialization.serialize(url, byteArrayOutputStream);
- objectOutput.writeObject(e);
- objectOutput.flushBuffer();
-
- ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(
- byteArrayOutputStream.toByteArray());
- ObjectInput deserialize = serialization.deserialize(url, byteArrayInputStream);
-
- Object read = deserialize.readObject();
- assertEquals("Hello", ((BizException) read).getMessage());
- }
-
- @Test
- public void test_BizException_WithType() throws Exception {
- BizException e = new BizException("Hello");
-
- ObjectOutput objectOutput = serialization.serialize(url, byteArrayOutputStream);
- objectOutput.writeObject(e);
- objectOutput.flushBuffer();
-
- ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(
- byteArrayOutputStream.toByteArray());
- ObjectInput deserialize = serialization.deserialize(url, byteArrayInputStream);
-
- Object read = deserialize.readObject(BizException.class);
- assertEquals("Hello", ((BizException) read).getMessage());
- }
-
- @Test
- public void test_BizExceptionNoDefaultConstructor() throws Exception {
- BizExceptionNoDefaultConstructor e = new BizExceptionNoDefaultConstructor("Hello");
-
- ObjectOutput objectOutput = serialization.serialize(url, byteArrayOutputStream);
- objectOutput.writeObject(e);
- objectOutput.flushBuffer();
-
- ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(
- byteArrayOutputStream.toByteArray());
- ObjectInput deserialize = serialization.deserialize(url, byteArrayInputStream);
-
- Object read = deserialize.readObject();
- assertEquals("Hello", ((BizExceptionNoDefaultConstructor) read).getMessage());
- }
-
- @Test
- public void test_BizExceptionNoDefaultConstructor_WithType() throws Exception {
- BizExceptionNoDefaultConstructor e = new BizExceptionNoDefaultConstructor("Hello");
-
- ObjectOutput objectOutput = serialization.serialize(url, byteArrayOutputStream);
- objectOutput.writeObject(e);
- objectOutput.flushBuffer();
-
- ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(
- byteArrayOutputStream.toByteArray());
- ObjectInput deserialize = serialization.deserialize(url, byteArrayInputStream);
-
- Object read = deserialize.readObject(BizExceptionNoDefaultConstructor.class);
- assertEquals("Hello", ((BizExceptionNoDefaultConstructor) read).getMessage());
- }
-
- @Test
- public void test_enum() throws Exception {
- assertObject(AnimalEnum.dog);
- }
-
- @Test
- public void test_enum_withType() throws Exception {
- assertObjectWithType(AnimalEnum.dog, AnimalEnum.class);
- }
-
- @Test
- public void test_Date() throws Exception {
- assertObject(new Date());
- }
-
- @Test
- public void test_Date_withType() throws Exception {
- assertObjectWithType(new Date(), Date.class);
- }
-
- @Test
- public void test_Time() throws Exception {
- assertObject(new Time(System.currentTimeMillis()));
- }
-
- @Test
- public void test_Time_withType() throws Exception {
- assertObjectWithType(new Time(System.currentTimeMillis()), Time.class);
- }
-
- @Test
- public void test_ByteWrap() throws Exception {
- assertObject(new Byte((byte) 12));
- }
-
- @Test
- public void test_ByteWrap_withType() throws Exception {
- assertObjectWithType(new Byte((byte) 12), Byte.class);
- }
-
- @Test
- public void test_LongWrap() throws Exception {
- assertObject(new Long(12));
- }
-
- @Test
- public void test_LongWrap_withType() throws Exception {
- assertObjectWithType(new Long(12), Long.class);
- }
-
- @Test
- public void test_BigInteger() throws Exception {
- assertObject(new BigInteger("23423434234234234"));
- }
-
- @Test
- public void test_BigInteger_withType() throws Exception {
- assertObjectWithType(new BigInteger("23423434234234234"), BigInteger.class);
- }
-
- @Test
- public void test_BigDecimal() throws Exception {
- assertObject(new BigDecimal("23423434234234234.341274832341234235"));
- }
-
- @Test
- public void test_BigDecimal_withType() throws Exception {
- assertObjectWithType(new BigDecimal("23423434234234234.341274832341234235"), BigDecimal.class);
- }
-
- @Test
- public void test_StringList_asListReturn() throws Exception {
- List<String> args = Arrays.asList(new String[]{"1", "b"});
-
- assertObject(args);
- }
-
- @Test
- public void test_StringArrayList() throws Exception {
- List<String> args = new ArrayList<String>(Arrays.asList(new String[]{"1", "b"}));
-
- assertObject(args);
- }
-
- @Test
- public void test_StringSet() throws Exception {
- Set<String> args = new HashSet<String>();
- args.add("1");
-
- assertObject(args);
- }
-
- @Test
- public void test_LinkedHashMap() throws Exception {
- LinkedHashMap<String, String> data = new LinkedHashMap<String, String>();
- data.put("1", "a");
- data.put("2", "b");
-
- ObjectOutput objectOutput = serialization.serialize(url, byteArrayOutputStream);
- objectOutput.writeObject(data);
- objectOutput.flushBuffer();
-
- ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(
- byteArrayOutputStream.toByteArray());
- ObjectInput deserialize = serialization.deserialize(url, byteArrayInputStream);
-
- Object read = deserialize.readObject();
- assertTrue(read instanceof LinkedHashMap);
- @SuppressWarnings("unchecked")
- String key1 = ((LinkedHashMap<String, String>) read).entrySet().iterator().next().getKey();
- assertEquals("1", key1);
-
- assertEquals(data, read);
-
- try {
- deserialize.readObject();
- fail();
- } catch (IOException expected) {
- }
- }
-
- // ================ Complex Collection Type ================
-
- @Test
- public void test_SPersonList() throws Exception {
- List<SerializablePerson> args = new ArrayList<SerializablePerson>();
- args.add(new SerializablePerson());
-
- assertObject(args);
- }
-
- @Test
- public void test_SPersonSet() throws Exception {
- Set<SerializablePerson> args = new HashSet<SerializablePerson>();
- args.add(new SerializablePerson());
-
- assertObject(args);
- }
-
- // ================ complex POJO =============
-
- @Test
- public void test_IntSPersonMap() throws Exception {
- Map<Integer, SerializablePerson> args = new HashMap<Integer, SerializablePerson>();
- args.put(1, new SerializablePerson());
-
- assertObject(args);
- }
-
- @Test
- public void test_StringSPersonMap() throws Exception {
- Map<String, SerializablePerson> args = new HashMap<String, SerializablePerson>();
- args.put("1", new SerializablePerson());
-
- assertObject(args);
- }
-
- @Test
- public void test_StringSPersonListMap() throws Exception {
- Map<String, List<SerializablePerson>> args = new HashMap<String, List<SerializablePerson>>();
-
- List<SerializablePerson> sublist = new ArrayList<SerializablePerson>();
- sublist.add(new SerializablePerson());
- args.put("1", sublist);
-
- assertObject(args);
- }
-
- @Test
- public void test_SPersonListList() throws Exception {
- List<List<SerializablePerson>> args = new ArrayList<List<SerializablePerson>>();
- List<SerializablePerson> sublist = new ArrayList<SerializablePerson>();
- sublist.add(new SerializablePerson());
- args.add(sublist);
-
- assertObject(args);
- }
-
- @Test
- public void test_BigPerson() throws Exception {
- assertObject(bigPerson);
- }
-
- @Test
- public void test_BigPerson_WithType() throws Exception {
- assertObjectWithType(bigPerson, BigPerson.class);
- }
-
- @Test
- public void test_MediaContent() throws Exception {
- assertObject(mediaContent);
- }
-
- @Test
- public void test_MediaContent_WithType() throws Exception {
- assertObjectWithType(mediaContent, MediaContent.class);
- }
-
- @Test
- public void test_MultiObject() throws Exception {
- ObjectOutput objectOutput = serialization.serialize(url, byteArrayOutputStream);
- objectOutput.writeBool(false);
- objectOutput.writeObject(bigPerson);
- objectOutput.writeByte((byte) 23);
- objectOutput.writeObject(mediaContent);
- objectOutput.writeInt(-23);
- objectOutput.flushBuffer();
-
- ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(
- byteArrayOutputStream.toByteArray());
- ObjectInput deserialize = serialization.deserialize(url, byteArrayInputStream);
-
- assertEquals(false, deserialize.readBool());
- assertEquals(bigPerson, deserialize.readObject());
- assertEquals((byte) 23, deserialize.readByte());
- assertEquals(mediaContent, deserialize.readObject());
- assertEquals(-23, deserialize.readInt());
-
- try {
- deserialize.readObject();
- fail();
- } catch (IOException expected) {
- }
- }
-
- @Test
- public void test_MultiObject_WithType() throws Exception {
- ObjectOutput objectOutput = serialization.serialize(url, byteArrayOutputStream);
- objectOutput.writeBool(false);
- objectOutput.writeObject(bigPerson);
- objectOutput.writeByte((byte) 23);
- objectOutput.writeObject(mediaContent);
- objectOutput.writeInt(-23);
- objectOutput.flushBuffer();
-
- ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(
- byteArrayOutputStream.toByteArray());
- ObjectInput deserialize = serialization.deserialize(url, byteArrayInputStream);
-
- assertEquals(false, deserialize.readBool());
- assertEquals(bigPerson, deserialize.readObject(BigPerson.class));
- assertEquals((byte) 23, deserialize.readByte());
- assertEquals(mediaContent, deserialize.readObject(MediaContent.class));
- assertEquals(-23, deserialize.readInt());
-
- try {
- deserialize.readObject();
- fail();
- } catch (IOException expected) {
- }
- }
-
-
- // abnormal case
-
- @Test
- public void test_MediaContent_badStream() throws Exception {
- ObjectOutput objectOutput = serialization.serialize(url, byteArrayOutputStream);
- objectOutput.writeObject(mediaContent);
- objectOutput.flushBuffer();
-
- byte[] byteArray = byteArrayOutputStream.toByteArray();
- for (int i = 0; i < byteArray.length; i++) {
- if (i % 3 == 0) {
- byteArray[i] = (byte) ~byteArray[i];
- }
- }
- ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(byteArray);
-
- try {
- ObjectInput deserialize = serialization.deserialize(url, byteArrayInputStream);
- @SuppressWarnings("unused") // local variable, convenient for debug
- Object read = deserialize.readObject();
- fail();
- } catch (IOException expected) {
- System.out.println(expected);
- }
- }
-
- @Test
- public void test_MediaContent_WithType_badStream() throws Exception {
- ObjectOutput objectOutput = serialization.serialize(url, byteArrayOutputStream);
- objectOutput.writeObject(mediaContent);
- objectOutput.flushBuffer();
-
- byte[] byteArray = byteArrayOutputStream.toByteArray();
- for (int i = 0; i < byteArray.length; i++) {
- if (i % 3 == 0) {
- byteArray[i] = (byte) ~byteArray[i];
- }
- }
- ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(byteArray);
-
- try {
- ObjectInput deserialize = serialization.deserialize(url, byteArrayInputStream);
- @SuppressWarnings("unused") // local variable, convenient for debug
- Object read = deserialize.readObject(MediaContent.class);
- fail();
- } catch (IOException expected) {
- System.out.println(expected);
- }
- }
-
-
- @Test(timeout = 3000)
- public void test_LoopReference() throws Exception {
- Map<String, Object> map = new HashMap<String, Object>();
- map.put("k1", "v1");
- map.put("self", map);
-
-
- ObjectOutput objectOutput = serialization.serialize(url, byteArrayOutputStream);
- objectOutput.writeObject(map);
- objectOutput.flushBuffer();
-
- ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(
- byteArrayOutputStream.toByteArray());
- ObjectInput deserialize = serialization.deserialize(url, byteArrayInputStream);
- @SuppressWarnings("unchecked")
- Map<String, Object> output = (Map<String, Object>) deserialize.readObject();
-
- assertEquals("v1", output.get("k1"));
- assertSame(output, output.get("self"));
- }
-
- // ================ final field test ================
-
- @Test
- public void test_URL_mutable_withType() throws Exception {
- URL data = URL.valueOf("dubbo://admin:hello1234@10.20.130.230:20880/context/path?version=1.0.0&application=morgan&noValue");
-
- ObjectOutput objectOutput = serialization.serialize(url, byteArrayOutputStream);
- objectOutput.writeObject(data);
- objectOutput.flushBuffer();
-
- ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(
- byteArrayOutputStream.toByteArray());
- ObjectInput deserialize = serialization.deserialize(url, byteArrayInputStream);
-
- URL actual = (URL) deserialize.readObject(URL.class);
- assertEquals(data, actual);
- assertEquals(data.getParameters(), actual.getParameters());
-
- try {
- deserialize.readObject();
- fail();
- } catch (IOException expected) {
- }
- }
-}
\ No newline at end of file
diff --git a/dubbo-serialization/dubbo-serialization-jdk/src/test/resources/log4j.xml b/dubbo-serialization/dubbo-serialization-jdk/src/test/resources/log4j.xml
deleted file mode 100644
index d045b92..0000000
--- a/dubbo-serialization/dubbo-serialization-jdk/src/test/resources/log4j.xml
+++ /dev/null
@@ -1,32 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- - Copyright 1999-2011 Alibaba Group.
- -
- - Licensed under the Apache License, Version 2.0 (the "License");
- - you may not use this file except in compliance with the License.
- - You may obtain a copy of the License at
- -
- - http://www.apache.org/licenses/LICENSE-2.0
- -
- - Unless required by applicable law or agreed to in writing, software
- - distributed under the License is distributed on an "AS IS" BASIS,
- - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- - See the License for the specific language governing permissions and
- - limitations under the License.
--->
-<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
-<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
- <!-- ===================================================================== -->
- <!-- 以下是appender的定义 -->
- <!-- ===================================================================== -->
- <appender name="dubbo" class="org.apache.dubbo.common.utils.DubboAppender">
- <param name="encoding" value="GBK"/>
- <layout class="org.apache.log4j.PatternLayout">
- <param name="ConversionPattern" value="%d %p [%c:%M] - %m%n"/>
- </layout>
- </appender>
- <root>
- <level value="INFO"/>
- <appender-ref ref="dubbo"/>
- </root>
-</log4j:configuration>
\ No newline at end of file
diff --git a/dubbo-serialization/dubbo-serialization-jdk/src/test/resources/org/apache/dubbo/common/serialize/dubbo/SimpleDO.fc b/dubbo-serialization/dubbo-serialization-jdk/src/test/resources/org/apache/dubbo/common/serialize/dubbo/SimpleDO.fc
deleted file mode 100644
index c8c083c..0000000
--- a/dubbo-serialization/dubbo-serialization-jdk/src/test/resources/org/apache/dubbo/common/serialize/dubbo/SimpleDO.fc
+++ /dev/null
@@ -1,2 +0,0 @@
-a,d,e,b,c
-str3,str2
\ No newline at end of file
diff --git a/dubbo-serialization/dubbo-serialization-kryo/src/test/java/org/apache/dubbo/common/model/BizException.java b/dubbo-serialization/dubbo-serialization-kryo/src/test/java/org/apache/dubbo/common/model/BizException.java
deleted file mode 100644
index 95f4046..0000000
--- a/dubbo-serialization/dubbo-serialization-kryo/src/test/java/org/apache/dubbo/common/model/BizException.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.dubbo.common.model;
-
-public class BizException extends RuntimeException {
-
- private static final long serialVersionUID = 1L;
-
- public BizException(String message) {
- super(message);
- }
-
- public BizException() {
- }
-}
\ No newline at end of file
diff --git a/dubbo-serialization/dubbo-serialization-kryo/src/test/java/org/apache/dubbo/common/model/BizExceptionNoDefaultConstructor.java b/dubbo-serialization/dubbo-serialization-kryo/src/test/java/org/apache/dubbo/common/model/BizExceptionNoDefaultConstructor.java
deleted file mode 100644
index f1ffadb..0000000
--- a/dubbo-serialization/dubbo-serialization-kryo/src/test/java/org/apache/dubbo/common/model/BizExceptionNoDefaultConstructor.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.dubbo.common.model;
-
-public class BizExceptionNoDefaultConstructor extends RuntimeException {
-
- private static final long serialVersionUID = 1L;
-
- public BizExceptionNoDefaultConstructor(String message) {
- super(message);
- }
-}
\ No newline at end of file
diff --git a/dubbo-serialization/dubbo-serialization-kryo/src/test/java/org/apache/dubbo/common/model/Person.java b/dubbo-serialization/dubbo-serialization-kryo/src/test/java/org/apache/dubbo/common/model/Person.java
deleted file mode 100644
index 5a551a7..0000000
--- a/dubbo-serialization/dubbo-serialization-kryo/src/test/java/org/apache/dubbo/common/model/Person.java
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.dubbo.common.model;
-
-import java.util.Arrays;
-
-public class Person {
- byte oneByte = 123;
- private String name = "name1";
- private int age = 11;
-
- private String[] value = {"value1", "value2"};
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public byte getOneByte() {
- return oneByte;
- }
-
- public void setOneByte(byte b) {
- this.oneByte = b;
- }
-
- public int getAge() {
- return age;
- }
-
- public void setAge(int age) {
- this.age = age;
- }
-
- public String[] getValue() {
- return value;
- }
-
- public void setValue(String[] value) {
- this.value = value;
- }
-
- @Override
- public String toString() {
- return String.format("Person name(%s) age(%d) byte(%s) [value=%s]", name, age, oneByte, Arrays.toString(value));
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + age;
- result = prime * result + ((name == null) ? 0 : name.hashCode());
- result = prime * result + Arrays.hashCode(value);
- return result;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj)
- return true;
- if (obj == null)
- return false;
- if (getClass() != obj.getClass())
- return false;
- Person other = (Person) obj;
- if (age != other.age)
- return false;
- if (name == null) {
- if (other.name != null)
- return false;
- } else if (!name.equals(other.name))
- return false;
- if (!Arrays.equals(value, other.value))
- return false;
- return true;
- }
-}
\ No newline at end of file
diff --git a/dubbo-serialization/dubbo-serialization-kryo/src/test/java/org/apache/dubbo/common/model/media/Image.java b/dubbo-serialization/dubbo-serialization-kryo/src/test/java/org/apache/dubbo/common/model/media/Image.java
deleted file mode 100644
index a59eff3..0000000
--- a/dubbo-serialization/dubbo-serialization-kryo/src/test/java/org/apache/dubbo/common/model/media/Image.java
+++ /dev/null
@@ -1,120 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.dubbo.common.model.media;
-
-
-public class Image implements java.io.Serializable {
- private static final long serialVersionUID = 1L;
- public String uri;
- public String title; // Can be null
- public int width;
- public int height;
- public Size size;
-
- public Image() {
- }
-
- public Image(String uri, String title, int width, int height, Size size) {
- this.height = height;
- this.title = title;
- this.uri = uri;
- this.width = width;
- this.size = size;
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o) return true;
- if (o == null || getClass() != o.getClass()) return false;
-
- Image image = (Image) o;
-
- if (height != image.height) return false;
- if (width != image.width) return false;
- if (size != image.size) return false;
- if (title != null ? !title.equals(image.title) : image.title != null) return false;
- if (uri != null ? !uri.equals(image.uri) : image.uri != null) return false;
-
- return true;
- }
-
- @Override
- public int hashCode() {
- int result = uri != null ? uri.hashCode() : 0;
- result = 31 * result + (title != null ? title.hashCode() : 0);
- result = 31 * result + width;
- result = 31 * result + height;
- result = 31 * result + (size != null ? size.hashCode() : 0);
- return result;
- }
-
- public String toString() {
- StringBuilder sb = new StringBuilder();
- sb.append("[Image ");
- sb.append("uri=").append(uri);
- sb.append(", title=").append(title);
- sb.append(", width=").append(width);
- sb.append(", height=").append(height);
- sb.append(", size=").append(size);
- sb.append("]");
- return sb.toString();
- }
-
- public String getUri() {
- return uri;
- }
-
- public void setUri(String uri) {
- this.uri = uri;
- }
-
- public String getTitle() {
- return title;
- }
-
- public void setTitle(String title) {
- this.title = title;
- }
-
- public int getWidth() {
- return width;
- }
-
- public void setWidth(int width) {
- this.width = width;
- }
-
- public int getHeight() {
- return height;
- }
-
- public void setHeight(int height) {
- this.height = height;
- }
-
- public Size getSize() {
- return size;
- }
-
- public void setSize(Size size) {
- this.size = size;
- }
-
- public enum Size {
- SMALL, LARGE
- }
-}
\ No newline at end of file
diff --git a/dubbo-serialization/dubbo-serialization-kryo/src/test/java/org/apache/dubbo/common/model/media/Media.java b/dubbo-serialization/dubbo-serialization-kryo/src/test/java/org/apache/dubbo/common/model/media/Media.java
deleted file mode 100644
index 042a3a5..0000000
--- a/dubbo-serialization/dubbo-serialization-kryo/src/test/java/org/apache/dubbo/common/model/media/Media.java
+++ /dev/null
@@ -1,205 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.dubbo.common.model.media;
-
-import java.util.List;
-
-@SuppressWarnings("serial")
-public class Media implements java.io.Serializable {
- public String uri;
- public String title; // Can be unset.
- public int width;
- public int height;
- public String format;
- public long duration;
- public long size;
- public int bitrate; // Can be unset.
- public boolean hasBitrate;
- public List<String> persons;
- public Player player;
- public String copyright; // Can be unset.
-
- public Media() {
- }
-
- public Media(String uri, String title, int width, int height, String format, long duration, long size, int bitrate, boolean hasBitrate, List<String> persons, Player player, String copyright) {
- this.uri = uri;
- this.title = title;
- this.width = width;
- this.height = height;
- this.format = format;
- this.duration = duration;
- this.size = size;
- this.bitrate = bitrate;
- this.hasBitrate = hasBitrate;
- this.persons = persons;
- this.player = player;
- this.copyright = copyright;
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o) return true;
- if (o == null || getClass() != o.getClass()) return false;
-
- Media media = (Media) o;
-
- if (bitrate != media.bitrate) return false;
- if (duration != media.duration) return false;
- if (hasBitrate != media.hasBitrate) return false;
- if (height != media.height) return false;
- if (size != media.size) return false;
- if (width != media.width) return false;
- if (copyright != null ? !copyright.equals(media.copyright) : media.copyright != null) return false;
- if (format != null ? !format.equals(media.format) : media.format != null) return false;
- if (persons != null ? !persons.equals(media.persons) : media.persons != null) return false;
- if (player != media.player) return false;
- if (title != null ? !title.equals(media.title) : media.title != null) return false;
- if (uri != null ? !uri.equals(media.uri) : media.uri != null) return false;
-
- return true;
- }
-
- @Override
- public int hashCode() {
- int result = uri != null ? uri.hashCode() : 0;
- result = 31 * result + (title != null ? title.hashCode() : 0);
- result = 31 * result + width;
- result = 31 * result + height;
- result = 31 * result + (format != null ? format.hashCode() : 0);
- result = 31 * result + (int) (duration ^ (duration >>> 32));
- result = 31 * result + (int) (size ^ (size >>> 32));
- result = 31 * result + bitrate;
- result = 31 * result + (hasBitrate ? 1 : 0);
- result = 31 * result + (persons != null ? persons.hashCode() : 0);
- result = 31 * result + (player != null ? player.hashCode() : 0);
- result = 31 * result + (copyright != null ? copyright.hashCode() : 0);
- return result;
- }
-
- public String toString() {
- StringBuilder sb = new StringBuilder();
- sb.append("[Media ");
- sb.append("uri=").append(uri);
- sb.append(", title=").append(title);
- sb.append(", width=").append(width);
- sb.append(", height=").append(height);
- sb.append(", format=").append(format);
- sb.append(", duration=").append(duration);
- sb.append(", size=").append(size);
- sb.append(", hasBitrate=").append(hasBitrate);
- sb.append(", bitrate=").append(String.valueOf(bitrate));
- sb.append(", persons=").append(persons);
- sb.append(", player=").append(player);
- sb.append(", copyright=").append(copyright);
- sb.append("]");
- return sb.toString();
- }
-
- public String getUri() {
- return uri;
- }
-
- public void setUri(String uri) {
- this.uri = uri;
- }
-
- public String getTitle() {
- return title;
- }
-
- public void setTitle(String title) {
- this.title = title;
- }
-
- public int getWidth() {
- return width;
- }
-
- public void setWidth(int width) {
- this.width = width;
- }
-
- public int getHeight() {
- return height;
- }
-
- public void setHeight(int height) {
- this.height = height;
- }
-
- public String getFormat() {
- return format;
- }
-
- public void setFormat(String format) {
- this.format = format;
- }
-
- public long getDuration() {
- return duration;
- }
-
- public void setDuration(long duration) {
- this.duration = duration;
- }
-
- public long getSize() {
- return size;
- }
-
- public void setSize(long size) {
- this.size = size;
- }
-
- public int getBitrate() {
- return bitrate;
- }
-
- public void setBitrate(int bitrate) {
- this.bitrate = bitrate;
- this.hasBitrate = true;
- }
-
- public List<String> getPersons() {
- return persons;
- }
-
- public void setPersons(List<String> persons) {
- this.persons = persons;
- }
-
- public Player getPlayer() {
- return player;
- }
-
- public void setPlayer(Player player) {
- this.player = player;
- }
-
- public String getCopyright() {
- return copyright;
- }
-
- public void setCopyright(String copyright) {
- this.copyright = copyright;
- }
-
- public enum Player {
- JAVA, FLASH
- }
-}
\ No newline at end of file
diff --git a/dubbo-serialization/dubbo-serialization-kryo/src/test/java/org/apache/dubbo/common/model/media/MediaContent.java b/dubbo-serialization/dubbo-serialization-kryo/src/test/java/org/apache/dubbo/common/model/media/MediaContent.java
deleted file mode 100644
index 7991f50..0000000
--- a/dubbo-serialization/dubbo-serialization-kryo/src/test/java/org/apache/dubbo/common/model/media/MediaContent.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.dubbo.common.model.media;
-
-import java.util.List;
-
-@SuppressWarnings("serial")
-public class MediaContent implements java.io.Serializable {
- public Media media;
- public List<Image> images;
-
- public MediaContent() {
- }
-
- public MediaContent(Media media, List<Image> images) {
- this.media = media;
- this.images = images;
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o) return true;
- if (o == null || getClass() != o.getClass()) return false;
-
- MediaContent that = (MediaContent) o;
-
- if (images != null ? !images.equals(that.images) : that.images != null) return false;
- if (media != null ? !media.equals(that.media) : that.media != null) return false;
-
- return true;
- }
-
- @Override
- public int hashCode() {
- int result = media != null ? media.hashCode() : 0;
- result = 31 * result + (images != null ? images.hashCode() : 0);
- return result;
- }
-
- public String toString() {
- StringBuilder sb = new StringBuilder();
- sb.append("[MediaContent: ");
- sb.append("media=").append(media);
- sb.append(", images=").append(images);
- sb.append("]");
- return sb.toString();
- }
-
- public Media getMedia() {
- return media;
- }
-
- public void setMedia(Media media) {
- this.media = media;
- }
-
- public List<Image> getImages() {
- return images;
- }
-
- public void setImages(List<Image> images) {
- this.images = images;
- }
-}
\ No newline at end of file
diff --git a/dubbo-serialization/dubbo-serialization-kryo/src/test/java/org/apache/dubbo/common/model/person/BigPerson.java b/dubbo-serialization/dubbo-serialization-kryo/src/test/java/org/apache/dubbo/common/model/person/BigPerson.java
deleted file mode 100644
index 4ce7900..0000000
--- a/dubbo-serialization/dubbo-serialization-kryo/src/test/java/org/apache/dubbo/common/model/person/BigPerson.java
+++ /dev/null
@@ -1,151 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.dubbo.common.model.person;
-
-import java.io.Serializable;
-
-public class BigPerson implements Serializable {
- private static final long serialVersionUID = 1L;
-
- String personId;
-
- String loginName;
-
- PersonStatus status;
-
- String email;
-
- String penName;
-
- PersonInfo infoProfile;
-
- public BigPerson() {
-
- }
-
- public BigPerson(String id) {
- this.personId = id;
- }
-
- public String getPersonId() {
- return personId;
- }
-
- public void setPersonId(String personId) {
- this.personId = personId;
- }
-
- public PersonInfo getInfoProfile() {
- return infoProfile;
- }
-
- public void setInfoProfile(PersonInfo infoProfile) {
- this.infoProfile = infoProfile;
- }
-
- public String getEmail() {
- return this.email;
- }
-
- public void setEmail(String email) {
- this.email = email;
- }
-
- public String getLoginName() {
- return this.loginName;
- }
-
- public void setLoginName(String loginName) {
- this.loginName = loginName;
- }
-
- public PersonStatus getStatus() {
- return this.status;
- }
-
- public void setStatus(PersonStatus status) {
- this.status = status;
- }
-
- public String getPenName() {
- return penName;
- }
-
- public void setPenName(String penName) {
- this.penName = penName;
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + ((email == null) ? 0 : email.hashCode());
- result = prime * result + ((infoProfile == null) ? 0 : infoProfile.hashCode());
- result = prime * result + ((loginName == null) ? 0 : loginName.hashCode());
- result = prime * result + ((penName == null) ? 0 : penName.hashCode());
- result = prime * result + ((personId == null) ? 0 : personId.hashCode());
- result = prime * result + ((status == null) ? 0 : status.hashCode());
- return result;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj)
- return true;
- if (obj == null)
- return false;
- if (getClass() != obj.getClass())
- return false;
- BigPerson other = (BigPerson) obj;
- if (email == null) {
- if (other.email != null)
- return false;
- } else if (!email.equals(other.email))
- return false;
- if (infoProfile == null) {
- if (other.infoProfile != null)
- return false;
- } else if (!infoProfile.equals(other.infoProfile))
- return false;
- if (loginName == null) {
- if (other.loginName != null)
- return false;
- } else if (!loginName.equals(other.loginName))
- return false;
- if (penName == null) {
- if (other.penName != null)
- return false;
- } else if (!penName.equals(other.penName))
- return false;
- if (personId == null) {
- if (other.personId != null)
- return false;
- } else if (!personId.equals(other.personId))
- return false;
- if (status != other.status)
- return false;
- return true;
- }
-
- @Override
- public String toString() {
- return "BigPerson [personId=" + personId + ", loginName=" + loginName + ", status="
- + status + ", email=" + email + ", penName=" + penName + ", infoProfile="
- + infoProfile + "]";
- }
-
-}
\ No newline at end of file
diff --git a/dubbo-serialization/dubbo-serialization-kryo/src/test/java/org/apache/dubbo/common/model/person/FullAddress.java b/dubbo-serialization/dubbo-serialization-kryo/src/test/java/org/apache/dubbo/common/model/person/FullAddress.java
deleted file mode 100644
index 3892167..0000000
--- a/dubbo-serialization/dubbo-serialization-kryo/src/test/java/org/apache/dubbo/common/model/person/FullAddress.java
+++ /dev/null
@@ -1,202 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.dubbo.common.model.person;
-
-import java.io.Serializable;
-
-public class FullAddress implements Serializable {
-
- private static final long serialVersionUID = 5163979984269419831L;
-
- private String countryId;
-
- private String countryName;
-
- private String provinceName;
-
- private String cityId;
-
- private String cityName;
-
- private String streetAddress;
-
- private String zipCode;
-
- public FullAddress() {
- }
-
- public FullAddress(String countryId, String provinceName, String cityId, String streetAddress,
- String zipCode) {
- this.countryId = countryId;
- this.countryName = countryId;
- this.provinceName = provinceName;
- this.cityId = cityId;
- this.cityName = cityId;
- this.streetAddress = streetAddress;
- this.zipCode = zipCode;
- }
-
- public FullAddress(String countryId, String countryName, String provinceName, String cityId,
- String cityName, String streetAddress, String zipCode) {
- this.countryId = countryId;
- this.countryName = countryName;
- this.provinceName = provinceName;
- this.cityId = cityId;
- this.cityName = cityName;
- this.streetAddress = streetAddress;
- this.zipCode = zipCode;
- }
-
- public String getCountryId() {
- return countryId;
- }
-
- public void setCountryId(String countryId) {
- this.countryId = countryId;
- }
-
- public String getCountryName() {
- return countryName;
- }
-
- public void setCountryName(String countryName) {
- this.countryName = countryName;
- }
-
- public String getProvinceName() {
- return provinceName;
- }
-
- public void setProvinceName(String provinceName) {
- this.provinceName = provinceName;
- }
-
- public String getCityId() {
- return cityId;
- }
-
- public void setCityId(String cityId) {
- this.cityId = cityId;
- }
-
- public String getCityName() {
- return cityName;
- }
-
- public void setCityName(String cityName) {
- this.cityName = cityName;
- }
-
- public String getStreetAddress() {
- return streetAddress;
- }
-
- public void setStreetAddress(String streetAddress) {
- this.streetAddress = streetAddress;
- }
-
- public String getZipCode() {
- return zipCode;
- }
-
- public void setZipCode(String zipCode) {
- this.zipCode = zipCode;
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + ((cityId == null) ? 0 : cityId.hashCode());
- result = prime * result + ((cityName == null) ? 0 : cityName.hashCode());
- result = prime * result + ((countryId == null) ? 0 : countryId.hashCode());
- result = prime * result + ((countryName == null) ? 0 : countryName.hashCode());
- result = prime * result + ((provinceName == null) ? 0 : provinceName.hashCode());
- result = prime * result + ((streetAddress == null) ? 0 : streetAddress.hashCode());
- result = prime * result + ((zipCode == null) ? 0 : zipCode.hashCode());
- return result;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj)
- return true;
- if (obj == null)
- return false;
- if (getClass() != obj.getClass())
- return false;
- FullAddress other = (FullAddress) obj;
- if (cityId == null) {
- if (other.cityId != null)
- return false;
- } else if (!cityId.equals(other.cityId))
- return false;
- if (cityName == null) {
- if (other.cityName != null)
- return false;
- } else if (!cityName.equals(other.cityName))
- return false;
- if (countryId == null) {
- if (other.countryId != null)
- return false;
- } else if (!countryId.equals(other.countryId))
- return false;
- if (countryName == null) {
- if (other.countryName != null)
- return false;
- } else if (!countryName.equals(other.countryName))
- return false;
- if (provinceName == null) {
- if (other.provinceName != null)
- return false;
- } else if (!provinceName.equals(other.provinceName))
- return false;
- if (streetAddress == null) {
- if (other.streetAddress != null)
- return false;
- } else if (!streetAddress.equals(other.streetAddress))
- return false;
- if (zipCode == null) {
- if (other.zipCode != null)
- return false;
- } else if (!zipCode.equals(other.zipCode))
- return false;
- return true;
- }
-
- @Override
- public String toString() {
- StringBuilder sb = new StringBuilder();
- if (countryName != null && countryName.length() > 0) {
- sb.append(countryName);
- }
- if (provinceName != null && provinceName.length() > 0) {
- sb.append(" ");
- sb.append(provinceName);
- }
- if (cityName != null && cityName.length() > 0) {
- sb.append(" ");
- sb.append(cityName);
- }
- if (streetAddress != null && streetAddress.length() > 0) {
- sb.append(" ");
- sb.append(streetAddress);
- }
- return sb.toString();
- }
-
-}
\ No newline at end of file
diff --git a/dubbo-serialization/dubbo-serialization-kryo/src/test/java/org/apache/dubbo/common/model/person/PersonInfo.java b/dubbo-serialization/dubbo-serialization-kryo/src/test/java/org/apache/dubbo/common/model/person/PersonInfo.java
deleted file mode 100644
index 15f1238..0000000
--- a/dubbo-serialization/dubbo-serialization-kryo/src/test/java/org/apache/dubbo/common/model/person/PersonInfo.java
+++ /dev/null
@@ -1,206 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.dubbo.common.model.person;
-
-import java.io.Serializable;
-import java.util.List;
-
-public class PersonInfo implements Serializable {
- private static final long serialVersionUID = 7443011149612231882L;
-
- List<Phone> phones;
-
- Phone fax;
-
- FullAddress fullAddress;
-
- String mobileNo;
-
- String name;
-
- boolean male;
-
- boolean female;
-
- String department;
-
- String jobTitle;
-
- String homepageUrl;
-
- public List<Phone> getPhones() {
- return phones;
- }
-
- public void setPhones(List<Phone> phones) {
- this.phones = phones;
- }
-
- public boolean isMale() {
- return male;
- }
-
- public void setMale(boolean male) {
- this.male = male;
- }
-
- public boolean isFemale() {
- return female;
- }
-
- public void setFemale(boolean female) {
- this.female = female;
- }
-
- public String getDepartment() {
- return department;
- }
-
- public void setDepartment(String department) {
- this.department = department;
- }
-
- public Phone getFax() {
- return fax;
- }
-
- public void setFax(Phone fax) {
- this.fax = fax;
- }
-
- public FullAddress getFullAddress() {
- return fullAddress;
- }
-
- public void setFullAddress(FullAddress fullAddress) {
- this.fullAddress = fullAddress;
- }
-
- public String getHomepageUrl() {
- return homepageUrl;
- }
-
- public void setHomepageUrl(String homepageUrl) {
- this.homepageUrl = homepageUrl;
- }
-
- public String getJobTitle() {
- return jobTitle;
- }
-
- public void setJobTitle(String jobTitle) {
- this.jobTitle = jobTitle;
- }
-
- public String getMobileNo() {
- return mobileNo;
- }
-
- public void setMobileNo(String mobileNo) {
- this.mobileNo = mobileNo;
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + ((department == null) ? 0 : department.hashCode());
- result = prime * result + ((fax == null) ? 0 : fax.hashCode());
- result = prime * result + (female ? 1231 : 1237);
- result = prime * result + ((fullAddress == null) ? 0 : fullAddress.hashCode());
- result = prime * result + ((homepageUrl == null) ? 0 : homepageUrl.hashCode());
- result = prime * result + ((jobTitle == null) ? 0 : jobTitle.hashCode());
- result = prime * result + (male ? 1231 : 1237);
- result = prime * result + ((mobileNo == null) ? 0 : mobileNo.hashCode());
- result = prime * result + ((name == null) ? 0 : name.hashCode());
- result = prime * result + ((phones == null) ? 0 : phones.hashCode());
- return result;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj)
- return true;
- if (obj == null)
- return false;
- if (getClass() != obj.getClass())
- return false;
- PersonInfo other = (PersonInfo) obj;
- if (department == null) {
- if (other.department != null)
- return false;
- } else if (!department.equals(other.department))
- return false;
- if (fax == null) {
- if (other.fax != null)
- return false;
- } else if (!fax.equals(other.fax))
- return false;
- if (female != other.female)
- return false;
- if (fullAddress == null) {
- if (other.fullAddress != null)
- return false;
- } else if (!fullAddress.equals(other.fullAddress))
- return false;
- if (homepageUrl == null) {
- if (other.homepageUrl != null)
- return false;
- } else if (!homepageUrl.equals(other.homepageUrl))
- return false;
- if (jobTitle == null) {
- if (other.jobTitle != null)
- return false;
- } else if (!jobTitle.equals(other.jobTitle))
- return false;
- if (male != other.male)
- return false;
- if (mobileNo == null) {
- if (other.mobileNo != null)
- return false;
- } else if (!mobileNo.equals(other.mobileNo))
- return false;
- if (name == null) {
- if (other.name != null)
- return false;
- } else if (!name.equals(other.name))
- return false;
- if (phones == null) {
- if (other.phones != null)
- return false;
- } else if (!phones.equals(other.phones))
- return false;
- return true;
- }
-
- @Override
- public String toString() {
- return "PersonInfo [phones=" + phones + ", fax=" + fax + ", fullAddress=" + fullAddress
- + ", mobileNo=" + mobileNo + ", name=" + name + ", male=" + male + ", female="
- + female + ", department=" + department + ", jobTitle=" + jobTitle
- + ", homepageUrl=" + homepageUrl + "]";
- }
-
-}
diff --git a/dubbo-serialization/dubbo-serialization-kryo/src/test/java/org/apache/dubbo/common/serialize/serialization/AbstractSerializationPersonFailTest.java b/dubbo-serialization/dubbo-serialization-kryo/src/test/java/org/apache/dubbo/common/serialize/serialization/AbstractSerializationPersonFailTest.java
deleted file mode 100644
index 5d27bb5..0000000
--- a/dubbo-serialization/dubbo-serialization-kryo/src/test/java/org/apache/dubbo/common/serialize/serialization/AbstractSerializationPersonFailTest.java
+++ /dev/null
@@ -1,137 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.dubbo.common.serialize.serialization;
-
-import org.apache.dubbo.common.model.Person;
-import org.apache.dubbo.common.serialize.ObjectOutput;
-
-import org.junit.Test;
-
-import java.io.NotSerializableException;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import static org.junit.Assert.assertThat;
-import static org.junit.Assert.fail;
-import static org.junit.matchers.JUnitMatchers.containsString;
-
-public abstract class AbstractSerializationPersonFailTest extends AbstractSerializationTest {
- @Test
- public void test_Person() throws Exception {
- try {
- ObjectOutput objectOutput = serialization.serialize(url, byteArrayOutputStream);
- objectOutput.writeObject(new Person());
- fail();
- } catch (NotSerializableException expected) {
- } catch (IllegalStateException expected) {
- assertThat(expected.getMessage(), containsString("Serialized class org.apache.dubbo.common.model.Person must implement java.io.Serializable"));
- }
- }
-
- @Test
- public void test_PersonList() throws Exception {
- List<Person> args = new ArrayList<Person>();
- args.add(new Person());
- try {
- ObjectOutput objectOutput = serialization.serialize(url, byteArrayOutputStream);
- objectOutput.writeObject(args);
- fail();
- } catch (NotSerializableException expected) {
- } catch (IllegalStateException expected) {
- assertThat(expected.getMessage(), containsString("Serialized class org.apache.dubbo.common.model.Person must implement java.io.Serializable"));
- }
- }
-
- @Test
- public void test_PersonSet() throws Exception {
- Set<Person> args = new HashSet<Person>();
- args.add(new Person());
- try {
- ObjectOutput objectOutput = serialization.serialize(url, byteArrayOutputStream);
- objectOutput.writeObject(args);
- fail();
- } catch (NotSerializableException expected) {
- } catch (IllegalStateException expected) {
- assertThat(expected.getMessage(), containsString("Serialized class org.apache.dubbo.common.model.Person must implement java.io.Serializable"));
- }
- }
-
- @Test
- public void test_IntPersonMap() throws Exception {
- Map<Integer, Person> args = new HashMap<Integer, Person>();
- args.put(1, new Person());
- try {
- ObjectOutput objectOutput = serialization.serialize(url, byteArrayOutputStream);
- objectOutput.writeObject(args);
- fail();
- } catch (NotSerializableException expected) {
- } catch (IllegalStateException expected) {
- assertThat(expected.getMessage(), containsString("Serialized class org.apache.dubbo.common.model.Person must implement java.io.Serializable"));
- }
- }
-
- @Test
- public void test_StringPersonMap() throws Exception {
- Map<String, Person> args = new HashMap<String, Person>();
- args.put("1", new Person());
- try {
- ObjectOutput objectOutput = serialization.serialize(url, byteArrayOutputStream);
- objectOutput.writeObject(args);
- fail();
- } catch (NotSerializableException expected) {
- } catch (IllegalStateException expected) {
- assertThat(expected.getMessage(), containsString("Serialized class org.apache.dubbo.common.model.Person must implement java.io.Serializable"));
- }
- }
-
- @Test
- public void test_StringPersonListMap() throws Exception {
- Map<String, List<Person>> args = new HashMap<String, List<Person>>();
-
- List<Person> sublist = new ArrayList<Person>();
- sublist.add(new Person());
- args.put("1", sublist);
- try {
- ObjectOutput objectOutput = serialization.serialize(url, byteArrayOutputStream);
- objectOutput.writeObject(args);
- fail();
- } catch (NotSerializableException expected) {
- } catch (IllegalStateException expected) {
- assertThat(expected.getMessage(), containsString("Serialized class org.apache.dubbo.common.model.Person must implement java.io.Serializable"));
- }
- }
-
- @Test
- public void test_PersonListList() throws Exception {
- List<List<Person>> args = new ArrayList<List<Person>>();
- List<Person> sublist = new ArrayList<Person>();
- sublist.add(new Person());
- args.add(sublist);
- try {
- ObjectOutput objectOutput = serialization.serialize(url, byteArrayOutputStream);
- objectOutput.writeObject(args);
- fail();
- } catch (NotSerializableException expected) {
- } catch (IllegalStateException expected) {
- assertThat(expected.getMessage(), containsString("Serialized class org.apache.dubbo.common.model.Person must implement java.io.Serializable"));
- }
- }
-}
\ No newline at end of file
diff --git a/dubbo-serialization/dubbo-serialization-kryo/src/test/java/org/apache/dubbo/common/serialize/serialization/AbstractSerializationPersonOkTest.java b/dubbo-serialization/dubbo-serialization-kryo/src/test/java/org/apache/dubbo/common/serialize/serialization/AbstractSerializationPersonOkTest.java
deleted file mode 100644
index 03395cb..0000000
--- a/dubbo-serialization/dubbo-serialization-kryo/src/test/java/org/apache/dubbo/common/serialize/serialization/AbstractSerializationPersonOkTest.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.dubbo.common.serialize.serialization;
-
-import org.apache.dubbo.common.model.Person;
-
-import org.junit.Test;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-public abstract class AbstractSerializationPersonOkTest extends AbstractSerializationTest {
- @Test
- public void test_Person() throws Exception {
- assertObject(new Person());
- }
-
- @Test
- public void test_Person_withType() throws Exception {
- assertObjectWithType(new Person(), Person.class);
- }
-
- @Test
- public void test_PersonList() throws Exception {
- List<Person> args = new ArrayList<Person>();
- args.add(new Person());
-
- assertObject(args);
- }
-
- @Test
- public void test_PersonSet() throws Exception {
- Set<Person> args = new HashSet<Person>();
- args.add(new Person());
-
- assertObject(args);
- }
-
- @Test
- public void test_IntPersonMap() throws Exception {
- Map<Integer, Person> args = new HashMap<Integer, Person>();
- args.put(1, new Person());
-
- assertObject(args);
- }
-
- @Test
- public void test_StringPersonMap() throws Exception {
- Map<String, Person> args = new HashMap<String, Person>();
- args.put("1", new Person());
-
- assertObject(args);
- }
-
- @Test
- public void test_StringPersonListMap() throws Exception {
- Map<String, List<Person>> args = new HashMap<String, List<Person>>();
-
- List<Person> sublist = new ArrayList<Person>();
- sublist.add(new Person());
- args.put("1", sublist);
-
- assertObject(args);
- }
-
- @Test
- public void test_PersonListList() throws Exception {
- List<List<Person>> args = new ArrayList<List<Person>>();
- List<Person> sublist = new ArrayList<Person>();
- sublist.add(new Person());
- args.add(sublist);
-
- assertObject(args);
- }
-}
\ No newline at end of file
diff --git a/dubbo-serialization/dubbo-serialization-kryo/src/test/java/org/apache/dubbo/common/serialize/serialization/AbstractSerializationTest.java b/dubbo-serialization/dubbo-serialization-kryo/src/test/java/org/apache/dubbo/common/serialize/serialization/AbstractSerializationTest.java
deleted file mode 100644
index 411627f..0000000
--- a/dubbo-serialization/dubbo-serialization-kryo/src/test/java/org/apache/dubbo/common/serialize/serialization/AbstractSerializationTest.java
+++ /dev/null
@@ -1,1215 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.dubbo.common.serialize.serialization;
-
-import org.apache.dubbo.common.URL;
-import org.apache.dubbo.common.model.AnimalEnum;
-import org.apache.dubbo.common.model.BizException;
-import org.apache.dubbo.common.model.BizExceptionNoDefaultConstructor;
-import org.apache.dubbo.common.model.SerializablePerson;
-import org.apache.dubbo.common.model.media.Image;
-import org.apache.dubbo.common.model.media.Image.Size;
-import org.apache.dubbo.common.model.media.Media;
-import org.apache.dubbo.common.model.media.Media.Player;
-import org.apache.dubbo.common.model.media.MediaContent;
-import org.apache.dubbo.common.model.person.BigPerson;
-import org.apache.dubbo.common.model.person.FullAddress;
-import org.apache.dubbo.common.model.person.PersonInfo;
-import org.apache.dubbo.common.model.person.PersonStatus;
-import org.apache.dubbo.common.model.person.Phone;
-import org.apache.dubbo.common.serialize.ObjectInput;
-import org.apache.dubbo.common.serialize.ObjectOutput;
-import org.apache.dubbo.common.serialize.Serialization;
-import org.junit.Test;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.math.BigDecimal;
-import java.math.BigInteger;
-import java.sql.Time;
-import java.time.LocalDateTime;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Random;
-import java.util.Set;
-
-import static org.junit.Assert.assertArrayEquals;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertSame;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-
-public abstract class AbstractSerializationTest {
- static Random random = new Random();
- Serialization serialization;
- URL url = new URL("protocol", "1.1.1.1", 1234);
- ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
-
- // ================ Primitive Type ================
- BigPerson bigPerson;
- MediaContent mediaContent;
-
- {
- bigPerson = new BigPerson();
- bigPerson.setPersonId("superman111");
- bigPerson.setLoginName("superman");
- bigPerson.setStatus(PersonStatus.ENABLED);
- bigPerson.setEmail("sm@1.com");
- bigPerson.setPenName("pname");
-
- ArrayList<Phone> phones = new ArrayList<Phone>();
- Phone phone1 = new Phone("86", "0571", "87654321", "001");
- Phone phone2 = new Phone("86", "0571", "87654322", "002");
- phones.add(phone1);
- phones.add(phone2);
-
- PersonInfo pi = new PersonInfo();
- pi.setPhones(phones);
- Phone fax = new Phone("86", "0571", "87654321", null);
- pi.setFax(fax);
- FullAddress addr = new FullAddress("CN", "zj", "3480", "wensanlu", "315000");
- pi.setFullAddress(addr);
- pi.setMobileNo("13584652131");
- pi.setMale(true);
- pi.setDepartment("b2b");
- pi.setHomepageUrl("www.capcom.com");
- pi.setJobTitle("qa");
- pi.setName("superman");
-
- bigPerson.setInfoProfile(pi);
- }
-
- {
- Media media = new Media();
- media.setUri("uri://中华人民共和国");
- media.setTitle("title");
- media.setWidth(1239);
- media.setHeight(1938);
- media.setFormat("format-xxxx");
- media.setDuration(93419235);
- media.setSize(3477897);
- media.setBitrate(94523);
- List<String> persons = new ArrayList<String>();
- persons.add("jerry");
- persons.add("tom");
- persons.add("lucy");
- media.setPersons(persons);
- media.setCopyright("1999-2011");
- media.setPlayer(Player.FLASH);
-
- List<Image> images = new ArrayList<Image>();
- for (int i = 0; i < 10; ++i) {
- Image image = new Image();
- image.setUri("url" + i);
- if (i % 2 == 0) image.setTitle("title" + i);
- image.setWidth(34 + i);
- image.setHeight(2323 + i);
- image.setSize((i % 2 == 0) ? Size.SMALL : Size.LARGE);
-
- images.add(image);
- }
-
- mediaContent = new MediaContent(media, images);
- }
-
- @Test
- public void test_Bool() throws Exception {
- ObjectOutput objectOutput = serialization.serialize(url, byteArrayOutputStream);
- objectOutput.writeBool(false);
- objectOutput.flushBuffer();
-
- ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(
- byteArrayOutputStream.toByteArray());
- ObjectInput deserialize = serialization.deserialize(url, byteArrayInputStream);
-
- assertFalse(deserialize.readBool());
-
- try {
- deserialize.readBool();
- fail();
- } catch (IOException expected) {
- }
- }
-
- @Test
- public void test_Bool_Multi() throws Exception {
- boolean[] array = new boolean[100];
- for (int i = 0; i < array.length; i++) {
- array[i] = random.nextBoolean();
- }
-
- ObjectOutput objectOutput = serialization.serialize(url, byteArrayOutputStream);
- for (boolean b : array) {
- objectOutput.writeBool(b);
- }
- objectOutput.flushBuffer();
-
- ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(
- byteArrayOutputStream.toByteArray());
- ObjectInput deserialize = serialization.deserialize(url, byteArrayInputStream);
-
- for (boolean b : array) {
- assertEquals(b, deserialize.readBool());
- }
-
- try {
- deserialize.readBool();
- fail();
- } catch (IOException expected) {
- }
- }
-
- @Test
- public void test_Byte() throws Exception {
- ObjectOutput objectOutput = serialization.serialize(url, byteArrayOutputStream);
- objectOutput.writeByte((byte) 123);
- objectOutput.flushBuffer();
-
- ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(
- byteArrayOutputStream.toByteArray());
- ObjectInput deserialize = serialization.deserialize(url, byteArrayInputStream);
-
- assertEquals((byte) 123, deserialize.readByte());
-
- try {
- deserialize.readByte();
- fail();
- } catch (IOException expected) {
- }
- }
-
- @Test
- public void test_Byte_Multi() throws Exception {
- byte[] array = new byte[100];
- random.nextBytes(array);
-
- ObjectOutput objectOutput = serialization.serialize(url, byteArrayOutputStream);
- for (byte b : array) {
- objectOutput.writeByte(b);
- }
- objectOutput.flushBuffer();
-
- ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(
- byteArrayOutputStream.toByteArray());
- ObjectInput deserialize = serialization.deserialize(url, byteArrayInputStream);
-
- for (byte b : array) {
- assertEquals(b, deserialize.readByte());
- }
-
- try {
- deserialize.readByte();
- fail();
- } catch (IOException expected) {
- }
- }
-
- @Test
- public void test_Short() throws Exception {
- ObjectOutput objectOutput = serialization.serialize(url, byteArrayOutputStream);
- objectOutput.writeShort((short) 123);
- objectOutput.flushBuffer();
-
- ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(
- byteArrayOutputStream.toByteArray());
- ObjectInput deserialize = serialization.deserialize(url, byteArrayInputStream);
-
- assertEquals((short) 123, deserialize.readShort());
-
- try {
- deserialize.readShort();
- fail();
- } catch (IOException expected) {
- }
- }
-
- @Test
- public void test_Integer() throws Exception {
- ObjectOutput objectOutput = serialization.serialize(url, byteArrayOutputStream);
- objectOutput.writeInt(1);
- objectOutput.flushBuffer();
-
- ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(
- byteArrayOutputStream.toByteArray());
- ObjectInput deserialize = serialization.deserialize(url, byteArrayInputStream);
-
- int i = deserialize.readInt();
- assertEquals(1, i);
-
- try {
- deserialize.readInt();
- fail();
- } catch (IOException expected) {
- }
- }
-
- @Test
- public void test_Long() throws Exception {
- ObjectOutput objectOutput = serialization.serialize(url, byteArrayOutputStream);
- objectOutput.writeLong(123L);
- objectOutput.flushBuffer();
-
- ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(
- byteArrayOutputStream.toByteArray());
- ObjectInput deserialize = serialization.deserialize(url, byteArrayInputStream);
-
- assertEquals(123L, deserialize.readLong());
-
- try {
- deserialize.readLong();
- fail();
- } catch (IOException expected) {
- }
- }
-
- @Test
- public void test_Float() throws Exception {
- ObjectOutput objectOutput = serialization.serialize(url, byteArrayOutputStream);
- objectOutput.writeFloat(1.28F);
- objectOutput.flushBuffer();
-
- ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(
- byteArrayOutputStream.toByteArray());
- ObjectInput deserialize = serialization.deserialize(url, byteArrayInputStream);
-
- assertTrue(1.28F == deserialize.readFloat());
-
- try {
- deserialize.readFloat();
- fail();
- } catch (IOException expected) {
- }
- }
-
- // ================== Util methods ==================
-
- @Test
- public void test_Double() throws Exception {
- ObjectOutput objectOutput = serialization.serialize(url, byteArrayOutputStream);
- objectOutput.writeDouble(1.28);
- objectOutput.flushBuffer();
-
- ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(
- byteArrayOutputStream.toByteArray());
- ObjectInput deserialize = serialization.deserialize(url, byteArrayInputStream);
-
- assertTrue(1.28 == deserialize.readDouble());
-
- try {
- deserialize.readDouble();
- fail();
- } catch (IOException expected) {
- }
- }
-
- @Test
- public void test_UtfString() throws Exception {
- ObjectOutput objectOutput = serialization.serialize(url, byteArrayOutputStream);
- objectOutput.writeUTF("123中华人民共和国");
- objectOutput.flushBuffer();
-
- ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(
- byteArrayOutputStream.toByteArray());
- ObjectInput deserialize = serialization.deserialize(url, byteArrayInputStream);
-
- assertEquals("123中华人民共和国", deserialize.readUTF());
-
- try {
- deserialize.readUTF();
- fail();
- } catch (IOException expected) {
- }
- }
-
- @Test
- public void test_Bytes() throws Exception {
- ObjectOutput objectOutput = serialization.serialize(url, byteArrayOutputStream);
- objectOutput.writeBytes("123中华人民共和国".getBytes());
- objectOutput.flushBuffer();
-
- ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(
- byteArrayOutputStream.toByteArray());
- ObjectInput deserialize = serialization.deserialize(url, byteArrayInputStream);
-
- assertArrayEquals("123中华人民共和国".getBytes(), deserialize.readBytes());
-
- try {
- deserialize.readBytes();
- fail();
- } catch (IOException expected) {
- }
- }
-
- @Test
- public void test_BytesRange() throws Exception {
- ObjectOutput objectOutput = serialization.serialize(url, byteArrayOutputStream);
- objectOutput.writeBytes("123中华人民共和国-新疆维吾尔自治区".getBytes(), 1, 9);
- objectOutput.flushBuffer();
-
- ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(
- byteArrayOutputStream.toByteArray());
- ObjectInput deserialize = serialization.deserialize(url, byteArrayInputStream);
-
- byte[] expectedArray = new byte[9];
- System.arraycopy("123中华人民共和国-新疆维吾尔自治区".getBytes(), 1, expectedArray, 0, expectedArray.length);
- assertArrayEquals(expectedArray, deserialize.readBytes());
-
- try {
- deserialize.readBytes();
- fail();
- } catch (IOException expected) {
- }
- }
-
- // ================ Array Type ================
-
- <T> void assertObjectArray(T[] data, Class<T[]> clazz) throws Exception {
- ObjectOutput objectOutput = serialization.serialize(url, byteArrayOutputStream);
- objectOutput.writeObject(data);
- objectOutput.flushBuffer();
-
- ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(
- byteArrayOutputStream.toByteArray());
- ObjectInput deserialize = serialization.deserialize(url, byteArrayInputStream);
-
- assertArrayEquals(data, clazz.cast(deserialize.readObject()));
-
- try {
- deserialize.readObject();
- fail();
- } catch (IOException expected) {
- }
- }
-
- <T> void assertObjectArrayWithType(T[] data, Class<T[]> clazz) throws Exception {
- ObjectOutput objectOutput = serialization.serialize(url, byteArrayOutputStream);
- objectOutput.writeObject(data);
- objectOutput.flushBuffer();
-
- ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(
- byteArrayOutputStream.toByteArray());
- ObjectInput deserialize = serialization.deserialize(url, byteArrayInputStream);
-
- assertArrayEquals(data, clazz.cast(deserialize.readObject(clazz)));
-
- try {
- deserialize.readObject(clazz);
- fail();
- } catch (IOException expected) {
- }
- }
-
- @SuppressWarnings("unchecked")
- <T> void assertObject(T data) throws Exception {
- ObjectOutput objectOutput = serialization.serialize(url, byteArrayOutputStream);
- objectOutput.writeObject(data);
- objectOutput.flushBuffer();
-
- ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(
- byteArrayOutputStream.toByteArray());
- ObjectInput deserialize = serialization.deserialize(url, byteArrayInputStream);
-
- assertEquals(data, (T) deserialize.readObject());
-
- try {
- deserialize.readObject();
- fail();
- } catch (IOException expected) {
- }
- }
-
- <T> void assertObjectWithType(T data, Class<T> clazz) throws Exception {
- ObjectOutput objectOutput = serialization.serialize(url, byteArrayOutputStream);
- objectOutput.writeObject(data);
- objectOutput.flushBuffer();
-
- ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(
- byteArrayOutputStream.toByteArray());
- ObjectInput deserialize = serialization.deserialize(url, byteArrayInputStream);
-
- assertEquals(data, (T) deserialize.readObject(clazz));
-
- try {
- deserialize.readObject(clazz);
- fail();
- } catch (IOException expected) {
- }
- }
-
- @Test
- public void test_boolArray() throws Exception {
- boolean[] data = new boolean[]{true, false, true};
-
- ObjectOutput objectOutput = serialization.serialize(url, byteArrayOutputStream);
- objectOutput.writeObject(data);
- objectOutput.flushBuffer();
-
- ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(
- byteArrayOutputStream.toByteArray());
- ObjectInput deserialize = serialization.deserialize(url, byteArrayInputStream);
-
- assertTrue(Arrays.equals(data, (boolean[]) deserialize.readObject()));
-
- try {
- deserialize.readObject();
- fail();
- } catch (IOException expected) {
- }
- }
-
- @Test
- public void test_boolArray_withType() throws Exception {
- boolean[] data = new boolean[]{true, false, true};
-
- ObjectOutput objectOutput = serialization.serialize(url, byteArrayOutputStream);
- objectOutput.writeObject(data);
- objectOutput.flushBuffer();
-
- ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(
- byteArrayOutputStream.toByteArray());
- ObjectInput deserialize = serialization.deserialize(url, byteArrayInputStream);
-
- assertTrue(Arrays.equals(data, (boolean[]) deserialize.readObject(boolean[].class)));
-
- try {
- deserialize.readObject(boolean[].class);
- fail();
- } catch (IOException expected) {
- }
- }
-
- @Test
- public void test_charArray() throws Exception {
- char[] data = new char[]{'a', '中', '无'};
-
- ObjectOutput objectOutput = serialization.serialize(url, byteArrayOutputStream);
- objectOutput.writeObject(data);
- objectOutput.flushBuffer();
-
- ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(
- byteArrayOutputStream.toByteArray());
- ObjectInput deserialize = serialization.deserialize(url, byteArrayInputStream);
-
- assertArrayEquals(data, (char[]) deserialize.readObject());
-
- try {
- deserialize.readObject();
- fail();
- } catch (IOException expected) {
- }
- }
-
- @Test
- public void test_charArray_withType() throws Exception {
- char[] data = new char[]{'a', '中', '无'};
-
- ObjectOutput objectOutput = serialization.serialize(url, byteArrayOutputStream);
- objectOutput.writeObject(data);
- objectOutput.flushBuffer();
-
- ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(
- byteArrayOutputStream.toByteArray());
- ObjectInput deserialize = serialization.deserialize(url, byteArrayInputStream);
-
- assertArrayEquals(data, (char[]) deserialize.readObject(char[].class));
-
- try {
- deserialize.readObject(char[].class);
- fail();
- } catch (IOException expected) {
- }
- }
-
- @Test
- public void test_shortArray() throws Exception {
- short[] data = new short[]{37, 39, 12};
-
- ObjectOutput objectOutput = serialization.serialize(url, byteArrayOutputStream);
- objectOutput.writeObject(data);
- objectOutput.flushBuffer();
-
- ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(
- byteArrayOutputStream.toByteArray());
- ObjectInput deserialize = serialization.deserialize(url, byteArrayInputStream);
-
- assertArrayEquals(data, (short[]) deserialize.readObject());
-
- try {
- deserialize.readObject();
- fail();
- } catch (IOException expected) {
- }
- }
-
- @Test
- public void test_shortArray_withType() throws Exception {
- short[] data = new short[]{37, 39, 12};
-
- ObjectOutput objectOutput = serialization.serialize(url, byteArrayOutputStream);
- objectOutput.writeObject(data);
- objectOutput.flushBuffer();
-
- ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(
- byteArrayOutputStream.toByteArray());
- ObjectInput deserialize = serialization.deserialize(url, byteArrayInputStream);
-
- assertArrayEquals(data, (short[]) deserialize.readObject(short[].class));
-
- try {
- deserialize.readObject(short[].class);
- fail();
- } catch (IOException expected) {
- }
- }
-
- @Test
- public void test_intArray() throws Exception {
- int[] data = new int[]{234, 0, -1};
-
- ObjectOutput objectOutput = serialization.serialize(url, byteArrayOutputStream);
- objectOutput.writeObject(data);
- objectOutput.flushBuffer();
-
- ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(
- byteArrayOutputStream.toByteArray());
- ObjectInput deserialize = serialization.deserialize(url, byteArrayInputStream);
-
- assertArrayEquals(data, (int[]) deserialize.readObject());
-
- try {
- deserialize.readObject();
- fail();
- } catch (IOException expected) {
- }
- }
-
- @Test
- public void test_intArray_withType() throws Exception {
- int[] data = new int[]{234, 0, -1};
-
- ObjectOutput objectOutput = serialization.serialize(url, byteArrayOutputStream);
- objectOutput.writeObject(data);
- objectOutput.flushBuffer();
-
- ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(
- byteArrayOutputStream.toByteArray());
- ObjectInput deserialize = serialization.deserialize(url, byteArrayInputStream);
-
- assertArrayEquals(data, (int[]) deserialize.readObject(int[].class));
-
- try {
- deserialize.readObject(int[].class);
- fail();
- } catch (IOException expected) {
- }
- }
-
- @Test
- public void test_longArray() throws Exception {
- long[] data = new long[]{234, 0, -1};
-
- ObjectOutput objectOutput = serialization.serialize(url, byteArrayOutputStream);
- objectOutput.writeObject(data);
- objectOutput.flushBuffer();
-
- ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(
- byteArrayOutputStream.toByteArray());
- ObjectInput deserialize = serialization.deserialize(url, byteArrayInputStream);
-
- assertArrayEquals(data, (long[]) deserialize.readObject());
-
- try {
- deserialize.readObject();
- fail();
- } catch (IOException expected) {
- }
- }
-
- @Test
- public void test_longArray_withType() throws Exception {
- long[] data = new long[]{234, 0, -1};
-
- ObjectOutput objectOutput = serialization.serialize(url, byteArrayOutputStream);
- objectOutput.writeObject(data);
- objectOutput.flushBuffer();
-
- ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(
- byteArrayOutputStream.toByteArray());
- ObjectInput deserialize = serialization.deserialize(url, byteArrayInputStream);
-
- assertArrayEquals(data, (long[]) deserialize.readObject(long[].class));
-
- try {
- deserialize.readObject(long[].class);
- fail();
- } catch (IOException expected) {
- }
- }
-
- @Test
- public void test_floatArray() throws Exception {
- float[] data = new float[]{37F, -3.14F, 123456.7F};
-
- ObjectOutput objectOutput = serialization.serialize(url, byteArrayOutputStream);
- objectOutput.writeObject(data);
- objectOutput.flushBuffer();
-
- ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(
- byteArrayOutputStream.toByteArray());
- ObjectInput deserialize = serialization.deserialize(url, byteArrayInputStream);
-
- assertArrayEquals(data, (float[]) deserialize.readObject(), 0.0001F);
-
- try {
- deserialize.readObject();
- fail();
- } catch (IOException expected) {
- }
- }
-
- @Test
- public void test_floatArray_withType() throws Exception {
- float[] data = new float[]{37F, -3.14F, 123456.7F};
-
- ObjectOutput objectOutput = serialization.serialize(url, byteArrayOutputStream);
- objectOutput.writeObject(data);
- objectOutput.flushBuffer();
-
- ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(
- byteArrayOutputStream.toByteArray());
- ObjectInput deserialize = serialization.deserialize(url, byteArrayInputStream);
-
- assertArrayEquals(data, (float[]) deserialize.readObject(float[].class), 0.0001F);
-
- try {
- deserialize.readObject(float[].class);
- fail();
- } catch (IOException expected) {
- }
- }
-
- @Test
- public void test_doubleArray() throws Exception {
- double[] data = new double[]{37D, -3.14D, 123456.7D};
-
- ObjectOutput objectOutput = serialization.serialize(url, byteArrayOutputStream);
- objectOutput.writeObject(data);
- objectOutput.flushBuffer();
-
- ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(
- byteArrayOutputStream.toByteArray());
- ObjectInput deserialize = serialization.deserialize(url, byteArrayInputStream);
-
- assertArrayEquals(data, (double[]) deserialize.readObject(), 0.0001);
-
- try {
- deserialize.readObject();
- fail();
- } catch (IOException expected) {
- }
- }
-
- @Test
- public void test_doubleArray_withType() throws Exception {
- double[] data = new double[]{37D, -3.14D, 123456.7D};
-
- ObjectOutput objectOutput = serialization.serialize(url, byteArrayOutputStream);
- objectOutput.writeObject(data);
- objectOutput.flushBuffer();
-
- ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(
- byteArrayOutputStream.toByteArray());
- ObjectInput deserialize = serialization.deserialize(url, byteArrayInputStream);
-
- assertArrayEquals(data, (double[]) deserialize.readObject(double[].class), 0.0001);
-
- try {
- deserialize.readObject(double[].class);
- fail();
- } catch (IOException expected) {
- }
- }
-
- @Test
- public void test_StringArray() throws Exception {
- assertObjectArray(new String[]{"1", "b"}, String[].class);
- }
-
- @Test
- public void test_StringArray_withType() throws Exception {
- assertObjectArrayWithType(new String[]{"1", "b"}, String[].class);
- }
-
- // ================ Simple Type ================
-
- @Test
- public void test_IntegerArray() throws Exception {
- assertObjectArray(new Integer[]{234, 0, -1}, Integer[].class);
- }
-
- @Test
- public void test_IntegerArray_withType() throws Exception {
- assertObjectArrayWithType(new Integer[]{234, 0, -1}, Integer[].class);
- }
-
- @Test
- public void test_EnumArray() throws Exception {
- assertObjectArray(new AnimalEnum[]{AnimalEnum.bull, AnimalEnum.cat, AnimalEnum.dog, AnimalEnum.horse}, AnimalEnum[].class);
- }
-
- @Test
- public void test_EnumArray_withType() throws Exception {
- assertObjectArrayWithType(new AnimalEnum[]{AnimalEnum.bull, AnimalEnum.cat, AnimalEnum.dog, AnimalEnum.horse}, AnimalEnum[].class);
- }
-
- @Test
- public void test_SPerson() throws Exception {
- assertObject(new SerializablePerson());
- }
-
- @Test
- public void test_SPerson_withType() throws Exception {
- assertObjectWithType(new SerializablePerson(), SerializablePerson.class);
- }
-
- @Test
- public void test_BizException() throws Exception {
- BizException e = new BizException("Hello");
-
- ObjectOutput objectOutput = serialization.serialize(url, byteArrayOutputStream);
- objectOutput.writeObject(e);
- objectOutput.flushBuffer();
-
- ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(
- byteArrayOutputStream.toByteArray());
- ObjectInput deserialize = serialization.deserialize(url, byteArrayInputStream);
-
- Object read = deserialize.readObject();
- assertEquals("Hello", ((BizException) read).getMessage());
- }
-
- @Test
- public void test_BizException_WithType() throws Exception {
- BizException e = new BizException("Hello");
-
- ObjectOutput objectOutput = serialization.serialize(url, byteArrayOutputStream);
- objectOutput.writeObject(e);
- objectOutput.flushBuffer();
-
- ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(
- byteArrayOutputStream.toByteArray());
- ObjectInput deserialize = serialization.deserialize(url, byteArrayInputStream);
-
- Object read = deserialize.readObject(BizException.class);
- assertEquals("Hello", ((BizException) read).getMessage());
- }
-
- @Test
- public void test_BizExceptionNoDefaultConstructor() throws Exception {
- BizExceptionNoDefaultConstructor e = new BizExceptionNoDefaultConstructor("Hello");
-
- ObjectOutput objectOutput = serialization.serialize(url, byteArrayOutputStream);
- objectOutput.writeObject(e);
- objectOutput.flushBuffer();
-
- ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(
- byteArrayOutputStream.toByteArray());
- ObjectInput deserialize = serialization.deserialize(url, byteArrayInputStream);
-
- Object read = deserialize.readObject();
- assertEquals("Hello", ((BizExceptionNoDefaultConstructor) read).getMessage());
- }
-
- @Test
- public void test_BizExceptionNoDefaultConstructor_WithType() throws Exception {
- BizExceptionNoDefaultConstructor e = new BizExceptionNoDefaultConstructor("Hello");
-
- ObjectOutput objectOutput = serialization.serialize(url, byteArrayOutputStream);
- objectOutput.writeObject(e);
- objectOutput.flushBuffer();
-
- ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(
- byteArrayOutputStream.toByteArray());
- ObjectInput deserialize = serialization.deserialize(url, byteArrayInputStream);
-
- Object read = deserialize.readObject(BizExceptionNoDefaultConstructor.class);
- assertEquals("Hello", ((BizExceptionNoDefaultConstructor) read).getMessage());
- }
-
- @Test
- public void test_LocalDateTime() throws Exception {
- assertObject(LocalDateTime.now());
- }
-
- @Test
- public void test_enum() throws Exception {
- assertObject(AnimalEnum.dog);
- }
-
- @Test
- public void test_enum_withType() throws Exception {
- assertObjectWithType(AnimalEnum.dog, AnimalEnum.class);
- }
-
- @Test
- public void test_Date() throws Exception {
- assertObject(new Date());
- }
-
- @Test
- public void test_Date_withType() throws Exception {
- assertObjectWithType(new Date(), Date.class);
- }
-
- @Test
- public void test_Time() throws Exception {
- assertObject(new Time(System.currentTimeMillis()));
- }
-
- @Test
- public void test_Time_withType() throws Exception {
- assertObjectWithType(new Time(System.currentTimeMillis()), Time.class);
- }
-
- @Test
- public void test_ByteWrap() throws Exception {
- assertObject(new Byte((byte) 12));
- }
-
- @Test
- public void test_ByteWrap_withType() throws Exception {
- assertObjectWithType(new Byte((byte) 12), Byte.class);
- }
-
- @Test
- public void test_LongWrap() throws Exception {
- assertObject(new Long(12));
- }
-
- @Test
- public void test_LongWrap_withType() throws Exception {
- assertObjectWithType(new Long(12), Long.class);
- }
-
- @Test
- public void test_BigInteger() throws Exception {
- assertObject(new BigInteger("23423434234234234"));
- }
-
- @Test
- public void test_BigInteger_withType() throws Exception {
- assertObjectWithType(new BigInteger("23423434234234234"), BigInteger.class);
- }
-
- @Test
- public void test_BigDecimal() throws Exception {
- assertObject(new BigDecimal("23423434234234234.341274832341234235"));
- }
-
- @Test
- public void test_BigDecimal_withType() throws Exception {
- assertObjectWithType(new BigDecimal("23423434234234234.341274832341234235"), BigDecimal.class);
- }
-
- @Test
- public void test_StringList_asListReturn() throws Exception {
- List<String> args = Arrays.asList(new String[]{"1", "b"});
-
- assertObject(args);
- }
-
- @Test
- public void test_StringArrayList() throws Exception {
- List<String> args = new ArrayList<String>(Arrays.asList(new String[]{"1", "b"}));
-
- assertObject(args);
- }
-
- @Test
- public void test_StringSet() throws Exception {
- Set<String> args = new HashSet<String>();
- args.add("1");
-
- assertObject(args);
- }
-
- @Test
- public void test_LinkedHashMap() throws Exception {
- LinkedHashMap<String, String> data = new LinkedHashMap<String, String>();
- data.put("1", "a");
- data.put("2", "b");
-
- ObjectOutput objectOutput = serialization.serialize(url, byteArrayOutputStream);
- objectOutput.writeObject(data);
- objectOutput.flushBuffer();
-
- ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(
- byteArrayOutputStream.toByteArray());
- ObjectInput deserialize = serialization.deserialize(url, byteArrayInputStream);
-
- Object read = deserialize.readObject();
- assertTrue(read instanceof LinkedHashMap);
- @SuppressWarnings("unchecked")
- String key1 = ((LinkedHashMap<String, String>) read).entrySet().iterator().next().getKey();
- assertEquals("1", key1);
-
- assertEquals(data, read);
-
- try {
- deserialize.readObject();
- fail();
- } catch (IOException expected) {
- }
- }
-
- // ================ Complex Collection Type ================
-
- @Test
- public void test_SPersonList() throws Exception {
- List<SerializablePerson> args = new ArrayList<SerializablePerson>();
- args.add(new SerializablePerson());
-
- assertObject(args);
- }
-
- @Test
- public void test_SPersonSet() throws Exception {
- Set<SerializablePerson> args = new HashSet<SerializablePerson>();
- args.add(new SerializablePerson());
-
- assertObject(args);
- }
-
- // ================ complex POJO =============
-
- @Test
- public void test_IntSPersonMap() throws Exception {
- Map<Integer, SerializablePerson> args = new HashMap<Integer, SerializablePerson>();
- args.put(1, new SerializablePerson());
-
- assertObject(args);
- }
-
- @Test
- public void test_StringSPersonMap() throws Exception {
- Map<String, SerializablePerson> args = new HashMap<String, SerializablePerson>();
- args.put("1", new SerializablePerson());
-
- assertObject(args);
- }
-
- @Test
- public void test_StringSPersonListMap() throws Exception {
- Map<String, List<SerializablePerson>> args = new HashMap<String, List<SerializablePerson>>();
-
- List<SerializablePerson> sublist = new ArrayList<SerializablePerson>();
- sublist.add(new SerializablePerson());
- args.put("1", sublist);
-
- assertObject(args);
- }
-
- @Test
- public void test_SPersonListList() throws Exception {
- List<List<SerializablePerson>> args = new ArrayList<List<SerializablePerson>>();
- List<SerializablePerson> sublist = new ArrayList<SerializablePerson>();
- sublist.add(new SerializablePerson());
- args.add(sublist);
-
- assertObject(args);
- }
-
- @Test
- public void test_BigPerson() throws Exception {
- assertObject(bigPerson);
- }
-
- @Test
- public void test_BigPerson_WithType() throws Exception {
- assertObjectWithType(bigPerson, BigPerson.class);
- }
-
- @Test
- public void test_MediaContent() throws Exception {
- assertObject(mediaContent);
- }
-
- @Test
- public void test_MediaContent_WithType() throws Exception {
- assertObjectWithType(mediaContent, MediaContent.class);
- }
-
- @Test
- public void test_MultiObject() throws Exception {
- ObjectOutput objectOutput = serialization.serialize(url, byteArrayOutputStream);
- objectOutput.writeBool(false);
- objectOutput.writeObject(bigPerson);
- objectOutput.writeByte((byte) 23);
- objectOutput.writeObject(mediaContent);
- objectOutput.writeInt(-23);
- objectOutput.flushBuffer();
-
- ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(
- byteArrayOutputStream.toByteArray());
- ObjectInput deserialize = serialization.deserialize(url, byteArrayInputStream);
-
- assertEquals(false, deserialize.readBool());
- assertEquals(bigPerson, deserialize.readObject());
- assertEquals((byte) 23, deserialize.readByte());
- assertEquals(mediaContent, deserialize.readObject());
- assertEquals(-23, deserialize.readInt());
-
- try {
- deserialize.readObject();
- fail();
- } catch (IOException expected) {
- }
- }
-
- @Test
- public void test_MultiObject_WithType() throws Exception {
- ObjectOutput objectOutput = serialization.serialize(url, byteArrayOutputStream);
- objectOutput.writeBool(false);
- objectOutput.writeObject(bigPerson);
- objectOutput.writeByte((byte) 23);
- objectOutput.writeObject(mediaContent);
- objectOutput.writeInt(-23);
- objectOutput.flushBuffer();
-
- ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(
- byteArrayOutputStream.toByteArray());
- ObjectInput deserialize = serialization.deserialize(url, byteArrayInputStream);
-
- assertEquals(false, deserialize.readBool());
- assertEquals(bigPerson, deserialize.readObject(BigPerson.class));
- assertEquals((byte) 23, deserialize.readByte());
- assertEquals(mediaContent, deserialize.readObject(MediaContent.class));
- assertEquals(-23, deserialize.readInt());
-
- try {
- deserialize.readObject();
- fail();
- } catch (IOException expected) {
- }
- }
-
-
- // abnormal case
-
- @Test
- public void test_MediaContent_badStream() throws Exception {
- ObjectOutput objectOutput = serialization.serialize(url, byteArrayOutputStream);
- objectOutput.writeObject(mediaContent);
- objectOutput.flushBuffer();
-
- byte[] byteArray = byteArrayOutputStream.toByteArray();
- for (int i = 0; i < byteArray.length; i++) {
- if (i % 3 == 0) {
- byteArray[i] = (byte) ~byteArray[i];
- }
- }
- ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(byteArray);
-
- try {
- ObjectInput deserialize = serialization.deserialize(url, byteArrayInputStream);
- @SuppressWarnings("unused") // local variable, convenient for debug
- Object read = deserialize.readObject();
- fail();
- } catch (IOException expected) {
- System.out.println(expected);
- }
- }
-
- @Test
- public void test_MediaContent_WithType_badStream() throws Exception {
- ObjectOutput objectOutput = serialization.serialize(url, byteArrayOutputStream);
- objectOutput.writeObject(mediaContent);
- objectOutput.flushBuffer();
-
- byte[] byteArray = byteArrayOutputStream.toByteArray();
- for (int i = 0; i < byteArray.length; i++) {
- if (i % 3 == 0) {
- byteArray[i] = (byte) ~byteArray[i];
- }
- }
- ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(byteArray);
-
- try {
- ObjectInput deserialize = serialization.deserialize(url, byteArrayInputStream);
- @SuppressWarnings("unused") // local variable, convenient for debug
- Object read = deserialize.readObject(MediaContent.class);
- fail();
- } catch (IOException expected) {
- System.out.println(expected);
- }
- }
-
-
- @Test(timeout = 3000)
- public void test_LoopReference() throws Exception {
- Map<String, Object> map = new HashMap<String, Object>();
- map.put("k1", "v1");
- map.put("self", map);
-
-
- ObjectOutput objectOutput = serialization.serialize(url, byteArrayOutputStream);
- objectOutput.writeObject(map);
- objectOutput.flushBuffer();
-
- ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(
- byteArrayOutputStream.toByteArray());
- ObjectInput deserialize = serialization.deserialize(url, byteArrayInputStream);
- @SuppressWarnings("unchecked")
- Map<String, Object> output = (Map<String, Object>) deserialize.readObject();
-
- assertEquals("v1", output.get("k1"));
- assertSame(output, output.get("self"));
- }
-
- // ================ final field test ================
-
- @Test
- public void test_URL_mutable_withType() throws Exception {
- URL data = URL.valueOf("dubbo://admin:hello1234@10.20.130.230:20880/context/path?version=1.0.0&application=morgan&noValue");
-
- ObjectOutput objectOutput = serialization.serialize(url, byteArrayOutputStream);
- objectOutput.writeObject(data);
- objectOutput.flushBuffer();
-
- ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(
- byteArrayOutputStream.toByteArray());
- ObjectInput deserialize = serialization.deserialize(url, byteArrayInputStream);
-
- URL actual = (URL) deserialize.readObject(URL.class);
- assertEquals(data, actual);
- assertEquals(data.getParameters(), actual.getParameters());
-
- try {
- deserialize.readObject();
- fail();
- } catch (IOException expected) {
- }
- }
-}
\ No newline at end of file
diff --git a/dubbo-serialization/dubbo-serialization-kryo/src/test/resources/log4j.xml b/dubbo-serialization/dubbo-serialization-kryo/src/test/resources/log4j.xml
deleted file mode 100644
index d045b92..0000000
--- a/dubbo-serialization/dubbo-serialization-kryo/src/test/resources/log4j.xml
+++ /dev/null
@@ -1,32 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- - Copyright 1999-2011 Alibaba Group.
- -
- - Licensed under the Apache License, Version 2.0 (the "License");
- - you may not use this file except in compliance with the License.
- - You may obtain a copy of the License at
- -
- - http://www.apache.org/licenses/LICENSE-2.0
- -
- - Unless required by applicable law or agreed to in writing, software
- - distributed under the License is distributed on an "AS IS" BASIS,
- - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- - See the License for the specific language governing permissions and
- - limitations under the License.
--->
-<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
-<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
- <!-- ===================================================================== -->
- <!-- 以下是appender的定义 -->
- <!-- ===================================================================== -->
- <appender name="dubbo" class="org.apache.dubbo.common.utils.DubboAppender">
- <param name="encoding" value="GBK"/>
- <layout class="org.apache.log4j.PatternLayout">
- <param name="ConversionPattern" value="%d %p [%c:%M] - %m%n"/>
- </layout>
- </appender>
- <root>
- <level value="INFO"/>
- <appender-ref ref="dubbo"/>
- </root>
-</log4j:configuration>
\ No newline at end of file
diff --git a/dubbo-serialization/dubbo-serialization-test/pom.xml b/dubbo-serialization/dubbo-serialization-test/pom.xml
new file mode 100644
index 0000000..8c8b8fa
--- /dev/null
+++ b/dubbo-serialization/dubbo-serialization-test/pom.xml
@@ -0,0 +1,68 @@
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <parent>
+ <artifactId>dubbo-serialization</artifactId>
+ <groupId>org.apache.dubbo</groupId>
+ <version>2.7.0-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+
+ <artifactId>dubbo-serialization-test</artifactId>
+ <packaging>jar</packaging>
+ <name>${project.artifactId}</name>
+ <description>The test serialization module of dubbo project</description>
+ <properties>
+ <skip_maven_deploy>false</skip_maven_deploy>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.dubbo</groupId>
+ <artifactId>dubbo-serialization-fastjson</artifactId>
+ <version>${project.parent.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.dubbo</groupId>
+ <artifactId>dubbo-serialization-fst</artifactId>
+ <version>${project.parent.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.dubbo</groupId>
+ <artifactId>dubbo-serialization-hessian2</artifactId>
+ <version>${project.parent.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.dubbo</groupId>
+ <artifactId>dubbo-serialization-jdk</artifactId>
+ <version>${project.parent.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.dubbo</groupId>
+ <artifactId>dubbo-serialization-kryo</artifactId>
+ <version>${project.parent.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.dubbo</groupId>
+ <artifactId>dubbo-serialization-api</artifactId>
+ <version>${project.parent.version}</version>
+ </dependency>
+ </dependencies>
+</project>
\ No newline at end of file
diff --git a/dubbo-serialization/dubbo-serialization-jdk/src/test/java/org/apache/dubbo/common/serialize/serialization/AbstractSerializationPersonFailTest.java b/dubbo-serialization/dubbo-serialization-test/src/test/java/org/apache/dubbo/common/serialize/base/AbstractSerializationPersonFailTest.java
similarity index 79%
rename from dubbo-serialization/dubbo-serialization-jdk/src/test/java/org/apache/dubbo/common/serialize/serialization/AbstractSerializationPersonFailTest.java
rename to dubbo-serialization/dubbo-serialization-test/src/test/java/org/apache/dubbo/common/serialize/base/AbstractSerializationPersonFailTest.java
index 5d27bb5..64df509 100644
--- a/dubbo-serialization/dubbo-serialization-jdk/src/test/java/org/apache/dubbo/common/serialize/serialization/AbstractSerializationPersonFailTest.java
+++ b/dubbo-serialization/dubbo-serialization-test/src/test/java/org/apache/dubbo/common/serialize/base/AbstractSerializationPersonFailTest.java
@@ -14,11 +14,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.dubbo.common.serialize.serialization;
+package org.apache.dubbo.common.serialize.base;
-import org.apache.dubbo.common.model.Person;
import org.apache.dubbo.common.serialize.ObjectOutput;
-
+import org.apache.dubbo.common.serialize.model.Person;
import org.junit.Test;
import java.io.NotSerializableException;
@@ -34,6 +33,9 @@ import static org.junit.Assert.fail;
import static org.junit.matchers.JUnitMatchers.containsString;
public abstract class AbstractSerializationPersonFailTest extends AbstractSerializationTest {
+
+ protected static final String FAIL_STRING = "Serialized class org.apache.dubbo.common.serialize.model.Person must implement java.io.Serializable";
+
@Test
public void test_Person() throws Exception {
try {
@@ -42,7 +44,7 @@ public abstract class AbstractSerializationPersonFailTest extends AbstractSerial
fail();
} catch (NotSerializableException expected) {
} catch (IllegalStateException expected) {
- assertThat(expected.getMessage(), containsString("Serialized class org.apache.dubbo.common.model.Person must implement java.io.Serializable"));
+ assertThat(expected.getMessage(), containsString(FAIL_STRING));
}
}
@@ -56,7 +58,7 @@ public abstract class AbstractSerializationPersonFailTest extends AbstractSerial
fail();
} catch (NotSerializableException expected) {
} catch (IllegalStateException expected) {
- assertThat(expected.getMessage(), containsString("Serialized class org.apache.dubbo.common.model.Person must implement java.io.Serializable"));
+ assertThat(expected.getMessage(), containsString(FAIL_STRING));
}
}
@@ -70,7 +72,8 @@ public abstract class AbstractSerializationPersonFailTest extends AbstractSerial
fail();
} catch (NotSerializableException expected) {
} catch (IllegalStateException expected) {
- assertThat(expected.getMessage(), containsString("Serialized class org.apache.dubbo.common.model.Person must implement java.io.Serializable"));
+ System.out.println("--------" + expected.getMessage());
+ assertThat(expected.getMessage(), containsString(FAIL_STRING));
}
}
@@ -84,7 +87,7 @@ public abstract class AbstractSerializationPersonFailTest extends AbstractSerial
fail();
} catch (NotSerializableException expected) {
} catch (IllegalStateException expected) {
- assertThat(expected.getMessage(), containsString("Serialized class org.apache.dubbo.common.model.Person must implement java.io.Serializable"));
+ assertThat(expected.getMessage(), containsString(FAIL_STRING));
}
}
@@ -98,7 +101,7 @@ public abstract class AbstractSerializationPersonFailTest extends AbstractSerial
fail();
} catch (NotSerializableException expected) {
} catch (IllegalStateException expected) {
- assertThat(expected.getMessage(), containsString("Serialized class org.apache.dubbo.common.model.Person must implement java.io.Serializable"));
+ assertThat(expected.getMessage(), containsString(FAIL_STRING));
}
}
@@ -115,7 +118,7 @@ public abstract class AbstractSerializationPersonFailTest extends AbstractSerial
fail();
} catch (NotSerializableException expected) {
} catch (IllegalStateException expected) {
- assertThat(expected.getMessage(), containsString("Serialized class org.apache.dubbo.common.model.Person must implement java.io.Serializable"));
+ assertThat(expected.getMessage(), containsString(FAIL_STRING));
}
}
@@ -131,7 +134,7 @@ public abstract class AbstractSerializationPersonFailTest extends AbstractSerial
fail();
} catch (NotSerializableException expected) {
} catch (IllegalStateException expected) {
- assertThat(expected.getMessage(), containsString("Serialized class org.apache.dubbo.common.model.Person must implement java.io.Serializable"));
+ assertThat(expected.getMessage(), containsString(FAIL_STRING));
}
}
}
\ No newline at end of file
diff --git a/dubbo-serialization/dubbo-serialization-hessian2/src/test/java/org/apache/dubbo/common/serialize/serialization/AbstractSerializationPersonOkTest.java b/dubbo-serialization/dubbo-serialization-test/src/test/java/org/apache/dubbo/common/serialize/base/AbstractSerializationPersonOkTest.java
similarity index 66%
rename from dubbo-serialization/dubbo-serialization-hessian2/src/test/java/org/apache/dubbo/common/serialize/serialization/AbstractSerializationPersonOkTest.java
rename to dubbo-serialization/dubbo-serialization-test/src/test/java/org/apache/dubbo/common/serialize/base/AbstractSerializationPersonOkTest.java
index 03395cb..6b8b77a 100644
--- a/dubbo-serialization/dubbo-serialization-hessian2/src/test/java/org/apache/dubbo/common/serialize/serialization/AbstractSerializationPersonOkTest.java
+++ b/dubbo-serialization/dubbo-serialization-test/src/test/java/org/apache/dubbo/common/serialize/base/AbstractSerializationPersonOkTest.java
@@ -14,10 +14,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.dubbo.common.serialize.serialization;
-
-import org.apache.dubbo.common.model.Person;
+package org.apache.dubbo.common.serialize.base;
+import org.apache.dubbo.common.serialize.model.person.Phone;
import org.junit.Test;
import java.util.ArrayList;
@@ -29,53 +28,53 @@ import java.util.Set;
public abstract class AbstractSerializationPersonOkTest extends AbstractSerializationTest {
@Test
- public void test_Person() throws Exception {
- assertObject(new Person());
+ public void test_Phone() throws Exception {
+ assertObject(new Phone());
}
@Test
public void test_Person_withType() throws Exception {
- assertObjectWithType(new Person(), Person.class);
+ assertObjectWithType(new Phone(), Phone.class);
}
@Test
public void test_PersonList() throws Exception {
- List<Person> args = new ArrayList<Person>();
- args.add(new Person());
+ List<Phone> args = new ArrayList<Phone>();
+ args.add(new Phone());
assertObject(args);
}
@Test
public void test_PersonSet() throws Exception {
- Set<Person> args = new HashSet<Person>();
- args.add(new Person());
+ Set<Phone> args = new HashSet<Phone>();
+ args.add(new Phone());
assertObject(args);
}
@Test
public void test_IntPersonMap() throws Exception {
- Map<Integer, Person> args = new HashMap<Integer, Person>();
- args.put(1, new Person());
+ Map<Integer, Phone> args = new HashMap<Integer, Phone>();
+ args.put(1, new Phone());
assertObject(args);
}
@Test
public void test_StringPersonMap() throws Exception {
- Map<String, Person> args = new HashMap<String, Person>();
- args.put("1", new Person());
+ Map<String, Phone> args = new HashMap<String, Phone>();
+ args.put("1", new Phone());
assertObject(args);
}
@Test
public void test_StringPersonListMap() throws Exception {
- Map<String, List<Person>> args = new HashMap<String, List<Person>>();
+ Map<String, List<Phone>> args = new HashMap<String, List<Phone>>();
- List<Person> sublist = new ArrayList<Person>();
- sublist.add(new Person());
+ List<Phone> sublist = new ArrayList<Phone>();
+ sublist.add(new Phone());
args.put("1", sublist);
assertObject(args);
@@ -83,9 +82,9 @@ public abstract class AbstractSerializationPersonOkTest extends AbstractSerializ
@Test
public void test_PersonListList() throws Exception {
- List<List<Person>> args = new ArrayList<List<Person>>();
- List<Person> sublist = new ArrayList<Person>();
- sublist.add(new Person());
+ List<List<Phone>> args = new ArrayList<List<Phone>>();
+ List<Phone> sublist = new ArrayList<Phone>();
+ sublist.add(new Phone());
args.add(sublist);
assertObject(args);
diff --git a/dubbo-serialization/dubbo-serialization-hessian2/src/test/java/org/apache/dubbo/common/serialize/serialization/AbstractSerializationTest.java b/dubbo-serialization/dubbo-serialization-test/src/test/java/org/apache/dubbo/common/serialize/base/AbstractSerializationTest.java
similarity index 96%
rename from dubbo-serialization/dubbo-serialization-hessian2/src/test/java/org/apache/dubbo/common/serialize/serialization/AbstractSerializationTest.java
rename to dubbo-serialization/dubbo-serialization-test/src/test/java/org/apache/dubbo/common/serialize/base/AbstractSerializationTest.java
index a40e378..f543a9e 100644
--- a/dubbo-serialization/dubbo-serialization-hessian2/src/test/java/org/apache/dubbo/common/serialize/serialization/AbstractSerializationTest.java
+++ b/dubbo-serialization/dubbo-serialization-test/src/test/java/org/apache/dubbo/common/serialize/base/AbstractSerializationTest.java
@@ -14,27 +14,25 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.dubbo.common.serialize.serialization;
+package org.apache.dubbo.common.serialize.base;
import org.apache.dubbo.common.URL;
-import org.apache.dubbo.common.model.AnimalEnum;
-import org.apache.dubbo.common.model.BizException;
-import org.apache.dubbo.common.model.BizExceptionNoDefaultConstructor;
-import org.apache.dubbo.common.model.SerializablePerson;
-import org.apache.dubbo.common.model.media.Image;
-import org.apache.dubbo.common.model.media.Image.Size;
-import org.apache.dubbo.common.model.media.Media;
-import org.apache.dubbo.common.model.media.Media.Player;
-import org.apache.dubbo.common.model.media.MediaContent;
-import org.apache.dubbo.common.model.person.BigPerson;
-import org.apache.dubbo.common.model.person.FullAddress;
-import org.apache.dubbo.common.model.person.PersonInfo;
-import org.apache.dubbo.common.model.person.PersonStatus;
-import org.apache.dubbo.common.model.person.Phone;
import org.apache.dubbo.common.serialize.ObjectInput;
import org.apache.dubbo.common.serialize.ObjectOutput;
import org.apache.dubbo.common.serialize.Serialization;
-
+import org.apache.dubbo.common.serialize.model.AnimalEnum;
+import org.apache.dubbo.common.serialize.model.BizException;
+import org.apache.dubbo.common.serialize.model.BizExceptionNoDefaultConstructor;
+import org.apache.dubbo.common.serialize.model.SerializablePerson;
+import org.apache.dubbo.common.serialize.model.media.Image;
+import org.apache.dubbo.common.serialize.model.media.Media;
+import org.apache.dubbo.common.serialize.model.media.MediaContent;
+import org.apache.dubbo.common.serialize.model.person.BigPerson;
+import org.apache.dubbo.common.serialize.model.person.FullAddress;
+import org.apache.dubbo.common.serialize.model.person.PersonInfo;
+import org.apache.dubbo.common.serialize.model.person.PersonStatus;
+import org.apache.dubbo.common.serialize.model.person.Phone;
+import org.junit.After;
import org.junit.Test;
import java.io.ByteArrayInputStream;
@@ -62,14 +60,14 @@ import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
public abstract class AbstractSerializationTest {
- static Random random = new Random();
- Serialization serialization;
- URL url = new URL("protocol", "1.1.1.1", 1234);
- ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
+ protected static Random random = new Random();
+ protected Serialization serialization;
+ protected URL url = new URL("protocol", "1.1.1.1", 1234);
+ protected ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
// ================ Primitive Type ================
- BigPerson bigPerson;
- MediaContent mediaContent;
+ protected BigPerson bigPerson;
+ protected MediaContent mediaContent;
{
bigPerson = new BigPerson();
@@ -117,7 +115,7 @@ public abstract class AbstractSerializationTest {
persons.add("lucy");
media.setPersons(persons);
media.setCopyright("1999-2011");
- media.setPlayer(Player.FLASH);
+ media.setPlayer(Media.Player.FLASH);
List<Image> images = new ArrayList<Image>();
for (int i = 0; i < 10; ++i) {
@@ -126,7 +124,7 @@ public abstract class AbstractSerializationTest {
if (i % 2 == 0) image.setTitle("title" + i);
image.setWidth(34 + i);
image.setHeight(2323 + i);
- image.setSize((i % 2 == 0) ? Size.SMALL : Size.LARGE);
+ image.setSize((i % 2 == 0) ? Image.Size.SMALL : Image.Size.LARGE);
images.add(image);
}
@@ -422,7 +420,7 @@ public abstract class AbstractSerializationTest {
}
@SuppressWarnings("unchecked")
- <T> void assertObject(T data) throws Exception {
+ public <T> void assertObject(T data) throws Exception {
ObjectOutput objectOutput = serialization.serialize(url, byteArrayOutputStream);
objectOutput.writeObject(data);
objectOutput.flushBuffer();
@@ -440,7 +438,7 @@ public abstract class AbstractSerializationTest {
}
}
- <T> void assertObjectWithType(T data, Class<T> clazz) throws Exception {
+ public <T> void assertObjectWithType(T data, Class<T> clazz) throws Exception {
ObjectOutput objectOutput = serialization.serialize(url, byteArrayOutputStream);
objectOutput.writeObject(data);
objectOutput.flushBuffer();
diff --git a/dubbo-serialization/dubbo-serialization-fastjson/src/test/java/org/apache/dubbo/common/serialize/fastjson/FastJsonObjectInputTest.java b/dubbo-serialization/dubbo-serialization-test/src/test/java/org/apache/dubbo/common/serialize/fastjson/FastJsonObjectInputTest.java
similarity index 98%
rename from dubbo-serialization/dubbo-serialization-fastjson/src/test/java/org/apache/dubbo/common/serialize/fastjson/FastJsonObjectInputTest.java
rename to dubbo-serialization/dubbo-serialization-test/src/test/java/org/apache/dubbo/common/serialize/fastjson/FastJsonObjectInputTest.java
index 185d24f..a115636 100644
--- a/dubbo-serialization/dubbo-serialization-fastjson/src/test/java/org/apache/dubbo/common/serialize/fastjson/FastJsonObjectInputTest.java
+++ b/dubbo-serialization/dubbo-serialization-test/src/test/java/org/apache/dubbo/common/serialize/fastjson/FastJsonObjectInputTest.java
@@ -16,8 +16,8 @@
*/
package org.apache.dubbo.common.serialize.fastjson;
-import org.apache.dubbo.common.serialize.fastjson.model.Person;
import com.alibaba.fastjson.JSONObject;
+import org.apache.dubbo.common.serialize.model.Person;
import org.junit.Test;
import java.io.ByteArrayInputStream;
diff --git a/dubbo-serialization/dubbo-serialization-fastjson/src/test/java/org/apache/dubbo/common/serialize/fastjson/FastJsonObjectOutputTest.java b/dubbo-serialization/dubbo-serialization-test/src/test/java/org/apache/dubbo/common/serialize/fastjson/FastJsonObjectOutputTest.java
similarity index 95%
rename from dubbo-serialization/dubbo-serialization-fastjson/src/test/java/org/apache/dubbo/common/serialize/fastjson/FastJsonObjectOutputTest.java
rename to dubbo-serialization/dubbo-serialization-test/src/test/java/org/apache/dubbo/common/serialize/fastjson/FastJsonObjectOutputTest.java
index 6cf0c35..6fca19f 100644
--- a/dubbo-serialization/dubbo-serialization-fastjson/src/test/java/org/apache/dubbo/common/serialize/fastjson/FastJsonObjectOutputTest.java
+++ b/dubbo-serialization/dubbo-serialization-test/src/test/java/org/apache/dubbo/common/serialize/fastjson/FastJsonObjectOutputTest.java
@@ -16,7 +16,7 @@
*/
package org.apache.dubbo.common.serialize.fastjson;
-import org.apache.dubbo.common.serialize.fastjson.model.Image;
+import org.apache.dubbo.common.serialize.model.media.Image;
import org.junit.Before;
import org.junit.Test;
@@ -24,7 +24,9 @@ import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
-import static org.hamcrest.CoreMatchers.*;
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.CoreMatchers.not;
+import static org.hamcrest.CoreMatchers.nullValue;
import static org.junit.Assert.assertThat;
public class FastJsonObjectOutputTest {
diff --git a/dubbo-serialization/dubbo-serialization-fastjson/src/test/java/org/apache/dubbo/common/serialize/fastjson/FastJsonSerializationTest.java b/dubbo-serialization/dubbo-serialization-test/src/test/java/org/apache/dubbo/common/serialize/fastjson/FastJsonSerializationTest.java
similarity index 91%
rename from dubbo-serialization/dubbo-serialization-fastjson/src/test/java/org/apache/dubbo/common/serialize/fastjson/FastJsonSerializationTest.java
rename to dubbo-serialization/dubbo-serialization-test/src/test/java/org/apache/dubbo/common/serialize/fastjson/FastJsonSerializationTest.java
index 298f05b..802c2ef 100644
--- a/dubbo-serialization/dubbo-serialization-fastjson/src/test/java/org/apache/dubbo/common/serialize/fastjson/FastJsonSerializationTest.java
+++ b/dubbo-serialization/dubbo-serialization-test/src/test/java/org/apache/dubbo/common/serialize/fastjson/FastJsonSerializationTest.java
@@ -18,9 +18,6 @@ package org.apache.dubbo.common.serialize.fastjson;
import org.apache.dubbo.common.serialize.ObjectInput;
import org.apache.dubbo.common.serialize.ObjectOutput;
-import org.apache.dubbo.common.serialize.fastjson.FastJsonObjectInput;
-import org.apache.dubbo.common.serialize.fastjson.FastJsonObjectOutput;
-import org.apache.dubbo.common.serialize.fastjson.FastJsonSerialization;
import org.hamcrest.Matchers;
import org.junit.Before;
import org.junit.Test;
diff --git a/dubbo-serialization/dubbo-serialization-fst/src/test/java/org/apache/dubbo/common/serialize/fst/FstFactoryTest.java b/dubbo-serialization/dubbo-serialization-test/src/test/java/org/apache/dubbo/common/serialize/fst/FstFactoryTest.java
similarity index 100%
rename from dubbo-serialization/dubbo-serialization-fst/src/test/java/org/apache/dubbo/common/serialize/fst/FstFactoryTest.java
rename to dubbo-serialization/dubbo-serialization-test/src/test/java/org/apache/dubbo/common/serialize/fst/FstFactoryTest.java
diff --git a/dubbo-serialization/dubbo-serialization-fst/src/test/java/org/apache/dubbo/common/serialize/fst/FstObjectInputTest.java b/dubbo-serialization/dubbo-serialization-test/src/test/java/org/apache/dubbo/common/serialize/fst/FstObjectInputTest.java
similarity index 90%
rename from dubbo-serialization/dubbo-serialization-fst/src/test/java/org/apache/dubbo/common/serialize/fst/FstObjectInputTest.java
rename to dubbo-serialization/dubbo-serialization-test/src/test/java/org/apache/dubbo/common/serialize/fst/FstObjectInputTest.java
index 849e838..fa7e95c 100644
--- a/dubbo-serialization/dubbo-serialization-fst/src/test/java/org/apache/dubbo/common/serialize/fst/FstObjectInputTest.java
+++ b/dubbo-serialization/dubbo-serialization-test/src/test/java/org/apache/dubbo/common/serialize/fst/FstObjectInputTest.java
@@ -16,15 +16,14 @@
*/
package org.apache.dubbo.common.serialize.fst;
-import org.apache.dubbo.common.serialize.fst.model.AnimalEnum;
-import org.apache.dubbo.common.serialize.fst.model.FullAddress;
+import org.apache.dubbo.common.serialize.model.person.FullAddress;
import org.junit.Test;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertThat;
public class FstObjectInputTest {
private FstObjectInput fstObjectInput;
diff --git a/dubbo-serialization/dubbo-serialization-fst/src/test/java/org/apache/dubbo/common/serialize/fst/FstObjectOutputTest.java b/dubbo-serialization/dubbo-serialization-test/src/test/java/org/apache/dubbo/common/serialize/fst/FstObjectOutputTest.java
similarity index 97%
rename from dubbo-serialization/dubbo-serialization-fst/src/test/java/org/apache/dubbo/common/serialize/fst/FstObjectOutputTest.java
rename to dubbo-serialization/dubbo-serialization-test/src/test/java/org/apache/dubbo/common/serialize/fst/FstObjectOutputTest.java
index d2796ab..ecf2335 100644
--- a/dubbo-serialization/dubbo-serialization-fst/src/test/java/org/apache/dubbo/common/serialize/fst/FstObjectOutputTest.java
+++ b/dubbo-serialization/dubbo-serialization-test/src/test/java/org/apache/dubbo/common/serialize/fst/FstObjectOutputTest.java
@@ -16,8 +16,8 @@
*/
package org.apache.dubbo.common.serialize.fst;
-import org.apache.dubbo.common.serialize.fst.model.AnimalEnum;
-import org.apache.dubbo.common.serialize.fst.model.FullAddress;
+import org.apache.dubbo.common.serialize.model.AnimalEnum;
+import org.apache.dubbo.common.serialize.model.person.FullAddress;
import org.junit.Before;
import org.junit.Test;
@@ -27,7 +27,7 @@ import java.io.IOException;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.nullValue;
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertThat;
public class FstObjectOutputTest {
private FstObjectOutput fstObjectOutput;
diff --git a/dubbo-serialization/dubbo-serialization-fst/src/test/java/org/apache/dubbo/common/serialize/fst/FstSerializationTest.java b/dubbo-serialization/dubbo-serialization-test/src/test/java/org/apache/dubbo/common/serialize/fst/FstSerializationTest.java
similarity index 100%
rename from dubbo-serialization/dubbo-serialization-fst/src/test/java/org/apache/dubbo/common/serialize/fst/FstSerializationTest.java
rename to dubbo-serialization/dubbo-serialization-test/src/test/java/org/apache/dubbo/common/serialize/fst/FstSerializationTest.java
diff --git a/dubbo-serialization/dubbo-serialization-hessian2/src/test/java/org/apache/dubbo/common/serialize/serialization/Hessian2SerializationTest.java b/dubbo-serialization/dubbo-serialization-test/src/test/java/org/apache/dubbo/common/serialize/hessian2/Hessian2PersonOkTest.java
similarity index 96%
copy from dubbo-serialization/dubbo-serialization-hessian2/src/test/java/org/apache/dubbo/common/serialize/serialization/Hessian2SerializationTest.java
copy to dubbo-serialization/dubbo-serialization-test/src/test/java/org/apache/dubbo/common/serialize/hessian2/Hessian2PersonOkTest.java
index e70dfd9..35ecb44 100644
--- a/dubbo-serialization/dubbo-serialization-hessian2/src/test/java/org/apache/dubbo/common/serialize/serialization/Hessian2SerializationTest.java
+++ b/dubbo-serialization/dubbo-serialization-test/src/test/java/org/apache/dubbo/common/serialize/hessian2/Hessian2PersonOkTest.java
@@ -14,12 +14,12 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.dubbo.common.serialize.serialization;
+package org.apache.dubbo.common.serialize.hessian2;
import org.apache.dubbo.common.serialize.ObjectInput;
import org.apache.dubbo.common.serialize.ObjectOutput;
-import org.apache.dubbo.common.serialize.hessian2.Hessian2Serialization;
-
+import org.apache.dubbo.common.serialize.base.AbstractSerializationPersonOkTest;
+import org.apache.dubbo.common.serialize.java.JavaSerialization;
import org.junit.Ignore;
import org.junit.Test;
@@ -30,13 +30,15 @@ import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
-public class Hessian2SerializationTest extends AbstractSerializationPersonFailTest {
+/**
+ * JdkPersonOkTest
+ */
+public class Hessian2PersonOkTest extends AbstractSerializationPersonOkTest {
+
{
serialization = new Hessian2Serialization();
}
- // Hessian2
-
@Test
public void test_boolArray_withType() throws Exception {
boolean[] data = new boolean[]{true, false, true};
@@ -203,9 +205,8 @@ public class Hessian2SerializationTest extends AbstractSerializationPersonFailTe
public void test_ByteWrap() throws Exception {
}
- // FIXME
@Ignore("Bad Stream read other type data")
@Test
public void test_MediaContent_badStream() throws Exception {
}
-}
\ No newline at end of file
+}
diff --git a/dubbo-serialization/dubbo-serialization-hessian2/src/test/java/org/apache/dubbo/common/serialize/serialization/Hessian2SerializationTest.java b/dubbo-serialization/dubbo-serialization-test/src/test/java/org/apache/dubbo/common/serialize/hessian2/Hessian2SerializationTest.java
similarity index 98%
rename from dubbo-serialization/dubbo-serialization-hessian2/src/test/java/org/apache/dubbo/common/serialize/serialization/Hessian2SerializationTest.java
rename to dubbo-serialization/dubbo-serialization-test/src/test/java/org/apache/dubbo/common/serialize/hessian2/Hessian2SerializationTest.java
index e70dfd9..94e6187 100644
--- a/dubbo-serialization/dubbo-serialization-hessian2/src/test/java/org/apache/dubbo/common/serialize/serialization/Hessian2SerializationTest.java
+++ b/dubbo-serialization/dubbo-serialization-test/src/test/java/org/apache/dubbo/common/serialize/hessian2/Hessian2SerializationTest.java
@@ -14,12 +14,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.dubbo.common.serialize.serialization;
+package org.apache.dubbo.common.serialize.hessian2;
import org.apache.dubbo.common.serialize.ObjectInput;
import org.apache.dubbo.common.serialize.ObjectOutput;
-import org.apache.dubbo.common.serialize.hessian2.Hessian2Serialization;
-
+import org.apache.dubbo.common.serialize.base.AbstractSerializationPersonFailTest;
import org.junit.Ignore;
import org.junit.Test;
diff --git a/dubbo-serialization/dubbo-serialization-jdk/src/test/java/org/apache/dubbo/common/serialize/serialization/CompactedJavaSerializationTest.java b/dubbo-serialization/dubbo-serialization-test/src/test/java/org/apache/dubbo/common/serialize/jdk/CompactedJavaSerializationTest.java
similarity index 88%
rename from dubbo-serialization/dubbo-serialization-jdk/src/test/java/org/apache/dubbo/common/serialize/serialization/CompactedJavaSerializationTest.java
rename to dubbo-serialization/dubbo-serialization-test/src/test/java/org/apache/dubbo/common/serialize/jdk/CompactedJavaSerializationTest.java
index 86ebb5e..551a428 100644
--- a/dubbo-serialization/dubbo-serialization-jdk/src/test/java/org/apache/dubbo/common/serialize/serialization/CompactedJavaSerializationTest.java
+++ b/dubbo-serialization/dubbo-serialization-test/src/test/java/org/apache/dubbo/common/serialize/jdk/CompactedJavaSerializationTest.java
@@ -14,9 +14,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.dubbo.common.serialize.serialization;
+package org.apache.dubbo.common.serialize.jdk;
+import org.apache.dubbo.common.serialize.base.AbstractSerializationPersonFailTest;
import org.apache.dubbo.common.serialize.java.CompactedJavaSerialization;
public class CompactedJavaSerializationTest extends AbstractSerializationPersonFailTest {
diff --git a/dubbo-serialization/dubbo-serialization-jdk/src/test/java/org/apache/dubbo/common/serialize/serialization/JavaSerializationTest.java b/dubbo-serialization/dubbo-serialization-test/src/test/java/org/apache/dubbo/common/serialize/jdk/JavaSerializationTest.java
similarity index 88%
copy from dubbo-serialization/dubbo-serialization-jdk/src/test/java/org/apache/dubbo/common/serialize/serialization/JavaSerializationTest.java
copy to dubbo-serialization/dubbo-serialization-test/src/test/java/org/apache/dubbo/common/serialize/jdk/JavaSerializationTest.java
index 058f605..4f7ca2b 100644
--- a/dubbo-serialization/dubbo-serialization-jdk/src/test/java/org/apache/dubbo/common/serialize/serialization/JavaSerializationTest.java
+++ b/dubbo-serialization/dubbo-serialization-test/src/test/java/org/apache/dubbo/common/serialize/jdk/JavaSerializationTest.java
@@ -14,9 +14,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.dubbo.common.serialize.serialization;
+package org.apache.dubbo.common.serialize.jdk;
+import org.apache.dubbo.common.serialize.base.AbstractSerializationPersonFailTest;
import org.apache.dubbo.common.serialize.java.JavaSerialization;
public class JavaSerializationTest extends AbstractSerializationPersonFailTest {
diff --git a/dubbo-serialization/dubbo-serialization-jdk/src/test/java/org/apache/dubbo/common/serialize/serialization/JavaSerializationTest.java b/dubbo-serialization/dubbo-serialization-test/src/test/java/org/apache/dubbo/common/serialize/jdk/JdkPersonOkTest.java
similarity index 80%
rename from dubbo-serialization/dubbo-serialization-jdk/src/test/java/org/apache/dubbo/common/serialize/serialization/JavaSerializationTest.java
rename to dubbo-serialization/dubbo-serialization-test/src/test/java/org/apache/dubbo/common/serialize/jdk/JdkPersonOkTest.java
index 058f605..b5da920 100644
--- a/dubbo-serialization/dubbo-serialization-jdk/src/test/java/org/apache/dubbo/common/serialize/serialization/JavaSerializationTest.java
+++ b/dubbo-serialization/dubbo-serialization-test/src/test/java/org/apache/dubbo/common/serialize/jdk/JdkPersonOkTest.java
@@ -14,13 +14,17 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.dubbo.common.serialize.serialization;
-
+package org.apache.dubbo.common.serialize.jdk;
+import org.apache.dubbo.common.serialize.base.AbstractSerializationPersonOkTest;
import org.apache.dubbo.common.serialize.java.JavaSerialization;
-public class JavaSerializationTest extends AbstractSerializationPersonFailTest {
+/**
+ * JdkPersonOkTest
+ */
+public class JdkPersonOkTest extends AbstractSerializationPersonOkTest {
+
{
serialization = new JavaSerialization();
}
-}
\ No newline at end of file
+}
diff --git a/dubbo-serialization/dubbo-serialization-jdk/src/test/java/org/apache/dubbo/common/serialize/serialization/NativeJavaSerializationTest.java b/dubbo-serialization/dubbo-serialization-test/src/test/java/org/apache/dubbo/common/serialize/jdk/NativeJavaSerializationTest.java
similarity index 88%
rename from dubbo-serialization/dubbo-serialization-jdk/src/test/java/org/apache/dubbo/common/serialize/serialization/NativeJavaSerializationTest.java
rename to dubbo-serialization/dubbo-serialization-test/src/test/java/org/apache/dubbo/common/serialize/jdk/NativeJavaSerializationTest.java
index d090890..a491cd6 100644
--- a/dubbo-serialization/dubbo-serialization-jdk/src/test/java/org/apache/dubbo/common/serialize/serialization/NativeJavaSerializationTest.java
+++ b/dubbo-serialization/dubbo-serialization-test/src/test/java/org/apache/dubbo/common/serialize/jdk/NativeJavaSerializationTest.java
@@ -14,8 +14,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.dubbo.common.serialize.serialization;
+package org.apache.dubbo.common.serialize.jdk;
+import org.apache.dubbo.common.serialize.base.AbstractSerializationPersonFailTest;
import org.apache.dubbo.common.serialize.nativejava.NativeJavaSerialization;
public class NativeJavaSerializationTest extends AbstractSerializationPersonFailTest {
diff --git a/dubbo-serialization/dubbo-serialization-kryo/src/test/java/org/apache/dubbo/common/serialize/serialization/KyroSerializationTest.java b/dubbo-serialization/dubbo-serialization-test/src/test/java/org/apache/dubbo/common/serialize/kryo/KryoPersonOkTest.java
similarity index 78%
copy from dubbo-serialization/dubbo-serialization-kryo/src/test/java/org/apache/dubbo/common/serialize/serialization/KyroSerializationTest.java
copy to dubbo-serialization/dubbo-serialization-test/src/test/java/org/apache/dubbo/common/serialize/kryo/KryoPersonOkTest.java
index a4fe585..6ed8636 100644
--- a/dubbo-serialization/dubbo-serialization-kryo/src/test/java/org/apache/dubbo/common/serialize/serialization/KyroSerializationTest.java
+++ b/dubbo-serialization/dubbo-serialization-test/src/test/java/org/apache/dubbo/common/serialize/kryo/KryoPersonOkTest.java
@@ -14,13 +14,16 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.dubbo.common.serialize.serialization;
+package org.apache.dubbo.common.serialize.kryo;
-import org.apache.dubbo.common.serialize.kryo.KryoSerialization;
+import org.apache.dubbo.common.serialize.base.AbstractSerializationPersonOkTest;
-public class KyroSerializationTest extends AbstractSerializationTest {
+/**
+ * KryoPersonOkTest
+ */
+public class KryoPersonOkTest extends AbstractSerializationPersonOkTest {
{
serialization = new KryoSerialization();
}
-}
\ No newline at end of file
+}
diff --git a/dubbo-serialization/dubbo-serialization-kryo/src/test/java/org/apache/dubbo/common/serialize/serialization/KyroSerializationTest.java b/dubbo-serialization/dubbo-serialization-test/src/test/java/org/apache/dubbo/common/serialize/kryo/KyroSerializationTest.java
similarity index 88%
rename from dubbo-serialization/dubbo-serialization-kryo/src/test/java/org/apache/dubbo/common/serialize/serialization/KyroSerializationTest.java
rename to dubbo-serialization/dubbo-serialization-test/src/test/java/org/apache/dubbo/common/serialize/kryo/KyroSerializationTest.java
index a4fe585..f6f318a 100644
--- a/dubbo-serialization/dubbo-serialization-kryo/src/test/java/org/apache/dubbo/common/serialize/serialization/KyroSerializationTest.java
+++ b/dubbo-serialization/dubbo-serialization-test/src/test/java/org/apache/dubbo/common/serialize/kryo/KyroSerializationTest.java
@@ -14,9 +14,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.dubbo.common.serialize.serialization;
+package org.apache.dubbo.common.serialize.kryo;
-import org.apache.dubbo.common.serialize.kryo.KryoSerialization;
+import org.apache.dubbo.common.serialize.base.AbstractSerializationTest;
public class KyroSerializationTest extends AbstractSerializationTest {
diff --git a/dubbo-serialization/dubbo-serialization-kryo/src/test/java/org/apache/dubbo/common/serialize/serialization/ReflectionUtilsTest.java b/dubbo-serialization/dubbo-serialization-test/src/test/java/org/apache/dubbo/common/serialize/kryo/ReflectionUtilsTest.java
similarity index 96%
rename from dubbo-serialization/dubbo-serialization-kryo/src/test/java/org/apache/dubbo/common/serialize/serialization/ReflectionUtilsTest.java
rename to dubbo-serialization/dubbo-serialization-test/src/test/java/org/apache/dubbo/common/serialize/kryo/ReflectionUtilsTest.java
index 39d0bcc..c596753 100644
--- a/dubbo-serialization/dubbo-serialization-kryo/src/test/java/org/apache/dubbo/common/serialize/serialization/ReflectionUtilsTest.java
+++ b/dubbo-serialization/dubbo-serialization-test/src/test/java/org/apache/dubbo/common/serialize/kryo/ReflectionUtilsTest.java
@@ -14,10 +14,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.dubbo.common.serialize.serialization;
+package org.apache.dubbo.common.serialize.kryo;
import org.apache.dubbo.common.serialize.kryo.utils.ReflectionUtils;
-
import org.junit.Test;
import static org.junit.Assert.assertFalse;
diff --git a/dubbo-serialization/dubbo-serialization-kryo/src/test/java/org/apache/dubbo/common/model/AnimalEnum.java b/dubbo-serialization/dubbo-serialization-test/src/test/java/org/apache/dubbo/common/serialize/model/AnimalEnum.java
similarity index 94%
rename from dubbo-serialization/dubbo-serialization-kryo/src/test/java/org/apache/dubbo/common/model/AnimalEnum.java
rename to dubbo-serialization/dubbo-serialization-test/src/test/java/org/apache/dubbo/common/serialize/model/AnimalEnum.java
index 760663f..db16dd9 100644
--- a/dubbo-serialization/dubbo-serialization-kryo/src/test/java/org/apache/dubbo/common/model/AnimalEnum.java
+++ b/dubbo-serialization/dubbo-serialization-test/src/test/java/org/apache/dubbo/common/serialize/model/AnimalEnum.java
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.dubbo.common.model;
+package org.apache.dubbo.common.serialize.model;
public enum AnimalEnum {
dog, cat, rat, cow, bull, horse;
diff --git a/dubbo-serialization/dubbo-serialization-hessian2/src/test/java/org/apache/dubbo/common/model/BizException.java b/dubbo-serialization/dubbo-serialization-test/src/test/java/org/apache/dubbo/common/serialize/model/BizException.java
similarity index 95%
rename from dubbo-serialization/dubbo-serialization-hessian2/src/test/java/org/apache/dubbo/common/model/BizException.java
rename to dubbo-serialization/dubbo-serialization-test/src/test/java/org/apache/dubbo/common/serialize/model/BizException.java
index 95f4046..96657e7 100644
--- a/dubbo-serialization/dubbo-serialization-hessian2/src/test/java/org/apache/dubbo/common/model/BizException.java
+++ b/dubbo-serialization/dubbo-serialization-test/src/test/java/org/apache/dubbo/common/serialize/model/BizException.java
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.dubbo.common.model;
+package org.apache.dubbo.common.serialize.model;
public class BizException extends RuntimeException {
diff --git a/dubbo-serialization/dubbo-serialization-jdk/src/test/java/org/apache/dubbo/common/model/BizExceptionNoDefaultConstructor.java b/dubbo-serialization/dubbo-serialization-test/src/test/java/org/apache/dubbo/common/serialize/model/BizExceptionNoDefaultConstructor.java
similarity index 95%
rename from dubbo-serialization/dubbo-serialization-jdk/src/test/java/org/apache/dubbo/common/model/BizExceptionNoDefaultConstructor.java
rename to dubbo-serialization/dubbo-serialization-test/src/test/java/org/apache/dubbo/common/serialize/model/BizExceptionNoDefaultConstructor.java
index f1ffadb..ab41fd5 100644
--- a/dubbo-serialization/dubbo-serialization-jdk/src/test/java/org/apache/dubbo/common/model/BizExceptionNoDefaultConstructor.java
+++ b/dubbo-serialization/dubbo-serialization-test/src/test/java/org/apache/dubbo/common/serialize/model/BizExceptionNoDefaultConstructor.java
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.dubbo.common.model;
+package org.apache.dubbo.common.serialize.model;
public class BizExceptionNoDefaultConstructor extends RuntimeException {
diff --git a/dubbo-serialization/dubbo-serialization-hessian2/src/test/java/org/apache/dubbo/common/model/Person.java b/dubbo-serialization/dubbo-serialization-test/src/test/java/org/apache/dubbo/common/serialize/model/Person.java
similarity index 98%
rename from dubbo-serialization/dubbo-serialization-hessian2/src/test/java/org/apache/dubbo/common/model/Person.java
rename to dubbo-serialization/dubbo-serialization-test/src/test/java/org/apache/dubbo/common/serialize/model/Person.java
index 5a551a7..5498622 100644
--- a/dubbo-serialization/dubbo-serialization-hessian2/src/test/java/org/apache/dubbo/common/model/Person.java
+++ b/dubbo-serialization/dubbo-serialization-test/src/test/java/org/apache/dubbo/common/serialize/model/Person.java
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.dubbo.common.model;
+package org.apache.dubbo.common.serialize.model;
import java.util.Arrays;
diff --git a/dubbo-serialization/dubbo-serialization-kryo/src/test/java/org/apache/dubbo/common/model/SerializablePerson.java b/dubbo-serialization/dubbo-serialization-test/src/test/java/org/apache/dubbo/common/serialize/model/SerializablePerson.java
similarity index 98%
rename from dubbo-serialization/dubbo-serialization-kryo/src/test/java/org/apache/dubbo/common/model/SerializablePerson.java
rename to dubbo-serialization/dubbo-serialization-test/src/test/java/org/apache/dubbo/common/serialize/model/SerializablePerson.java
index d78c592..b5ecad9 100644
--- a/dubbo-serialization/dubbo-serialization-kryo/src/test/java/org/apache/dubbo/common/model/SerializablePerson.java
+++ b/dubbo-serialization/dubbo-serialization-test/src/test/java/org/apache/dubbo/common/serialize/model/SerializablePerson.java
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.dubbo.common.model;
+package org.apache.dubbo.common.serialize.model;
import java.io.Serializable;
import java.util.Arrays;
diff --git a/dubbo-serialization/dubbo-serialization-hessian2/src/test/java/org/apache/dubbo/common/model/media/Image.java b/dubbo-serialization/dubbo-serialization-test/src/test/java/org/apache/dubbo/common/serialize/model/media/Image.java
similarity index 98%
rename from dubbo-serialization/dubbo-serialization-hessian2/src/test/java/org/apache/dubbo/common/model/media/Image.java
rename to dubbo-serialization/dubbo-serialization-test/src/test/java/org/apache/dubbo/common/serialize/model/media/Image.java
index a59eff3..da235d2 100644
--- a/dubbo-serialization/dubbo-serialization-hessian2/src/test/java/org/apache/dubbo/common/model/media/Image.java
+++ b/dubbo-serialization/dubbo-serialization-test/src/test/java/org/apache/dubbo/common/serialize/model/media/Image.java
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.dubbo.common.model.media;
+package org.apache.dubbo.common.serialize.model.media;
public class Image implements java.io.Serializable {
diff --git a/dubbo-serialization/dubbo-serialization-hessian2/src/test/java/org/apache/dubbo/common/model/media/Media.java b/dubbo-serialization/dubbo-serialization-test/src/test/java/org/apache/dubbo/common/serialize/model/media/Media.java
similarity index 99%
rename from dubbo-serialization/dubbo-serialization-hessian2/src/test/java/org/apache/dubbo/common/model/media/Media.java
rename to dubbo-serialization/dubbo-serialization-test/src/test/java/org/apache/dubbo/common/serialize/model/media/Media.java
index 042a3a5..555f847 100644
--- a/dubbo-serialization/dubbo-serialization-hessian2/src/test/java/org/apache/dubbo/common/model/media/Media.java
+++ b/dubbo-serialization/dubbo-serialization-test/src/test/java/org/apache/dubbo/common/serialize/model/media/Media.java
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.dubbo.common.model.media;
+package org.apache.dubbo.common.serialize.model.media;
import java.util.List;
diff --git a/dubbo-serialization/dubbo-serialization-jdk/src/test/java/org/apache/dubbo/common/model/media/MediaContent.java b/dubbo-serialization/dubbo-serialization-test/src/test/java/org/apache/dubbo/common/serialize/model/media/MediaContent.java
similarity index 97%
rename from dubbo-serialization/dubbo-serialization-jdk/src/test/java/org/apache/dubbo/common/model/media/MediaContent.java
rename to dubbo-serialization/dubbo-serialization-test/src/test/java/org/apache/dubbo/common/serialize/model/media/MediaContent.java
index 7991f50..3b65e99 100644
--- a/dubbo-serialization/dubbo-serialization-jdk/src/test/java/org/apache/dubbo/common/model/media/MediaContent.java
+++ b/dubbo-serialization/dubbo-serialization-test/src/test/java/org/apache/dubbo/common/serialize/model/media/MediaContent.java
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.dubbo.common.model.media;
+package org.apache.dubbo.common.serialize.model.media;
import java.util.List;
diff --git a/dubbo-serialization/dubbo-serialization-hessian2/src/test/java/org/apache/dubbo/common/model/person/BigPerson.java b/dubbo-serialization/dubbo-serialization-test/src/test/java/org/apache/dubbo/common/serialize/model/person/BigPerson.java
similarity index 98%
rename from dubbo-serialization/dubbo-serialization-hessian2/src/test/java/org/apache/dubbo/common/model/person/BigPerson.java
rename to dubbo-serialization/dubbo-serialization-test/src/test/java/org/apache/dubbo/common/serialize/model/person/BigPerson.java
index 4ce7900..063f5a9 100644
--- a/dubbo-serialization/dubbo-serialization-hessian2/src/test/java/org/apache/dubbo/common/model/person/BigPerson.java
+++ b/dubbo-serialization/dubbo-serialization-test/src/test/java/org/apache/dubbo/common/serialize/model/person/BigPerson.java
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.dubbo.common.model.person;
+package org.apache.dubbo.common.serialize.model.person;
import java.io.Serializable;
diff --git a/dubbo-serialization/dubbo-serialization-hessian2/src/test/java/org/apache/dubbo/common/model/person/FullAddress.java b/dubbo-serialization/dubbo-serialization-test/src/test/java/org/apache/dubbo/common/serialize/model/person/FullAddress.java
similarity index 99%
rename from dubbo-serialization/dubbo-serialization-hessian2/src/test/java/org/apache/dubbo/common/model/person/FullAddress.java
rename to dubbo-serialization/dubbo-serialization-test/src/test/java/org/apache/dubbo/common/serialize/model/person/FullAddress.java
index 3892167..4f762cf 100644
--- a/dubbo-serialization/dubbo-serialization-hessian2/src/test/java/org/apache/dubbo/common/model/person/FullAddress.java
+++ b/dubbo-serialization/dubbo-serialization-test/src/test/java/org/apache/dubbo/common/serialize/model/person/FullAddress.java
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.dubbo.common.model.person;
+package org.apache.dubbo.common.serialize.model.person;
import java.io.Serializable;
diff --git a/dubbo-serialization/dubbo-serialization-hessian2/src/test/java/org/apache/dubbo/common/model/person/PersonInfo.java b/dubbo-serialization/dubbo-serialization-test/src/test/java/org/apache/dubbo/common/serialize/model/person/PersonInfo.java
similarity index 99%
rename from dubbo-serialization/dubbo-serialization-hessian2/src/test/java/org/apache/dubbo/common/model/person/PersonInfo.java
rename to dubbo-serialization/dubbo-serialization-test/src/test/java/org/apache/dubbo/common/serialize/model/person/PersonInfo.java
index 15f1238..5377d77 100644
--- a/dubbo-serialization/dubbo-serialization-hessian2/src/test/java/org/apache/dubbo/common/model/person/PersonInfo.java
+++ b/dubbo-serialization/dubbo-serialization-test/src/test/java/org/apache/dubbo/common/serialize/model/person/PersonInfo.java
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.dubbo.common.model.person;
+package org.apache.dubbo.common.serialize.model.person;
import java.io.Serializable;
import java.util.List;
diff --git a/dubbo-serialization/dubbo-serialization-kryo/src/test/java/org/apache/dubbo/common/model/person/PersonStatus.java b/dubbo-serialization/dubbo-serialization-test/src/test/java/org/apache/dubbo/common/serialize/model/person/PersonStatus.java
similarity index 93%
rename from dubbo-serialization/dubbo-serialization-kryo/src/test/java/org/apache/dubbo/common/model/person/PersonStatus.java
rename to dubbo-serialization/dubbo-serialization-test/src/test/java/org/apache/dubbo/common/serialize/model/person/PersonStatus.java
index 62869c2..f5ae72c 100644
--- a/dubbo-serialization/dubbo-serialization-kryo/src/test/java/org/apache/dubbo/common/model/person/PersonStatus.java
+++ b/dubbo-serialization/dubbo-serialization-test/src/test/java/org/apache/dubbo/common/serialize/model/person/PersonStatus.java
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.dubbo.common.model.person;
+package org.apache.dubbo.common.serialize.model.person;
public enum PersonStatus {
ENABLED,
diff --git a/dubbo-serialization/dubbo-serialization-kryo/src/test/java/org/apache/dubbo/common/model/person/Phone.java b/dubbo-serialization/dubbo-serialization-test/src/test/java/org/apache/dubbo/common/serialize/model/person/Phone.java
similarity index 98%
rename from dubbo-serialization/dubbo-serialization-kryo/src/test/java/org/apache/dubbo/common/model/person/Phone.java
rename to dubbo-serialization/dubbo-serialization-test/src/test/java/org/apache/dubbo/common/serialize/model/person/Phone.java
index 41fd38a..1822eae 100644
--- a/dubbo-serialization/dubbo-serialization-kryo/src/test/java/org/apache/dubbo/common/model/person/Phone.java
+++ b/dubbo-serialization/dubbo-serialization-test/src/test/java/org/apache/dubbo/common/serialize/model/person/Phone.java
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.dubbo.common.model.person;
+package org.apache.dubbo.common.serialize.model.person;
import java.io.Serializable;
diff --git a/dubbo-serialization/dubbo-serialization-api/src/test/java/org/apache/dubbo/common/serialize/support/SerializableClassRegistryTest.java b/dubbo-serialization/dubbo-serialization-test/src/test/java/org/apache/dubbo/common/serialize/support/SerializableClassRegistryTest.java
similarity index 80%
rename from dubbo-serialization/dubbo-serialization-api/src/test/java/org/apache/dubbo/common/serialize/support/SerializableClassRegistryTest.java
rename to dubbo-serialization/dubbo-serialization-test/src/test/java/org/apache/dubbo/common/serialize/support/SerializableClassRegistryTest.java
index efde85c..4a3a4ad 100644
--- a/dubbo-serialization/dubbo-serialization-api/src/test/java/org/apache/dubbo/common/serialize/support/SerializableClassRegistryTest.java
+++ b/dubbo-serialization/dubbo-serialization-test/src/test/java/org/apache/dubbo/common/serialize/support/SerializableClassRegistryTest.java
@@ -16,8 +16,11 @@
*/
package org.apache.dubbo.common.serialize.support;
+import org.apache.dubbo.common.serialize.model.SerializablePerson;
+import org.apache.dubbo.common.serialize.model.person.Phone;
import org.junit.Test;
+import java.io.Serializable;
import java.util.Map;
import static org.hamcrest.Matchers.equalTo;
@@ -26,16 +29,10 @@ import static org.junit.Assert.assertThat;
public class SerializableClassRegistryTest {
@Test
public void testAddClasses() {
- SerializableClassRegistry.registerClass(A.class);
- SerializableClassRegistry.registerClass(B.class);
+ SerializableClassRegistry.registerClass(SerializablePerson.class);
+ SerializableClassRegistry.registerClass(Phone.class);
Map<Class, Object> registeredClasses = SerializableClassRegistry.getRegisteredClasses();
assertThat(registeredClasses.size(), equalTo(2));
}
-
- private class A {
- }
-
- private class B {
- }
}
\ No newline at end of file
diff --git a/dubbo-serialization/dubbo-serialization-test/src/test/resources/log4j.xml b/dubbo-serialization/dubbo-serialization-test/src/test/resources/log4j.xml
new file mode 100644
index 0000000..f71c553
--- /dev/null
+++ b/dubbo-serialization/dubbo-serialization-test/src/test/resources/log4j.xml
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
+<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
+ <appender name="dubbo" class="org.apache.dubbo.common.utils.DubboAppender">
+ <param name="encoding" value="GBK"/>
+ <layout class="org.apache.log4j.PatternLayout">
+ <param name="ConversionPattern" value="%d %p [%c:%M] - %m%n"/>
+ </layout>
+ </appender>
+ <root>
+ <level value="INFO"/>
+ <appender-ref ref="dubbo"/>
+ </root>
+</log4j:configuration>
\ No newline at end of file
diff --git a/dubbo-serialization/dubbo-serialization-kryo/src/test/resources/org/apache/dubbo/common/serialize/dubbo/SimpleDO.fc b/dubbo-serialization/dubbo-serialization-test/src/test/resources/org.apache.dubbo.common.serialize.dubbo/SimpleDO.fc
similarity index 100%
rename from dubbo-serialization/dubbo-serialization-kryo/src/test/resources/org/apache/dubbo/common/serialize/dubbo/SimpleDO.fc
rename to dubbo-serialization/dubbo-serialization-test/src/test/resources/org.apache.dubbo.common.serialize.dubbo/SimpleDO.fc
diff --git a/dubbo-serialization/pom.xml b/dubbo-serialization/pom.xml
index 3201877..9c2e869 100644
--- a/dubbo-serialization/pom.xml
+++ b/dubbo-serialization/pom.xml
@@ -24,7 +24,7 @@
<artifactId>dubbo-serialization</artifactId>
<packaging>pom</packaging>
<name>${project.artifactId}</name>
- <description>The rpc module of dubbo project</description>
+ <description>The serialization module of dubbo project</description>
<properties>
<skip_maven_deploy>false</skip_maven_deploy>
</properties>
@@ -35,5 +35,6 @@
<module>dubbo-serialization-kryo</module>
<module>dubbo-serialization-fst</module>
<module>dubbo-serialization-jdk</module>
+ <module>dubbo-serialization-test</module>
</modules>
</project>