Skip to content

Commit

Permalink
Sofaboot 4.0 support (#97)
Browse files Browse the repository at this point in the history
* feat: atomic

* feat: ignore failure when set accessible

* feat: replace reflection with specific get set for atomic-s

* fix: remove handle

* fix: log level

* feat: stack trace serialize without reflect

* add test case for stack trace

* fix: log

* feat: throw v1

* feat: throwable

* format

* format

* chore: cr fix

* chore: format

* add ci fo jdk17

* update jdk

* remove version specific

* version

* chore: add ci on sofaboot-4.0-support

* 3.5.0.beta.1 release

* remove aci on sofaboot-4.0-support

* feat: add support on java util currency

* format

* init 3.5 snapshot

* optimized code (#94)

Co-authored-by: liujianjun.ljj <liujianjun.ljj@antgroup.com>

* format

* fix: ref problem on currency

* format

* enhance: ref

* fix: test

* fix: test exception

* fix: curency test

---------

Co-authored-by: 均源 <zhangminglun.zml@antgroup.com>
Co-authored-by: evenliu <evenljj@163.com>
Co-authored-by: liujianjun.ljj <liujianjun.ljj@antgroup.com>
  • Loading branch information
4 people authored Aug 14, 2023
1 parent 515d5d7 commit f25f4e0
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,14 @@ public static void setUp() {
* 'cause' is bound to lost here as getCause may return null
*/
@Test
public void test_case_1() throws IOException {
public void test_case_1() {
if (isLessThanJdk17) {
test_JavaCurrencyWrapper(factory, originFactory);
try {
test_JavaCurrencyWrapper(factory, originFactory);
} catch (Exception e) {
e.printStackTrace();
Assert.assertNull(e.getMessage(), e);
}
}
}

Expand All @@ -77,9 +82,14 @@ public void test_case_1() throws IOException {
* @throws IOException
*/
@Test
public void test_case_2() throws IOException {
public void test_case_2() {
if (isLessThanJdk17) {
test_JavaCurrencyWrapper(originFactory, factory);
try {
test_JavaCurrencyWrapper(originFactory, factory);
} catch (Exception e) {
e.printStackTrace();
Assert.assertNull(e.getMessage(), e);
}
}
}

Expand All @@ -88,16 +98,26 @@ public void test_case_2() throws IOException {
* @throws IOException
*/
@Test
public void test_case_3() throws IOException {
public void test_case_3() {
if (isLessThanJdk17) {
test_JavaCurrencyDirectly(factory, originFactory);
try {
test_JavaCurrencyDirectly(factory, originFactory);
} catch (Exception e) {
e.printStackTrace();
Assert.assertNull(e.getMessage(), e);
}
}
}

@Test
public void test_case_4() throws IOException {
public void test_case_4() {
if (isLessThanJdk17) {
test_JavaCurrencyDirectly(originFactory, factory);
try {
test_JavaCurrencyDirectly(originFactory, factory);
} catch (Exception e) {
e.printStackTrace();
Assert.assertNull(e.getMessage(), e);
}
}
}

Expand All @@ -106,9 +126,14 @@ public void test_case_4() throws IOException {
* @throws IOException
*/
@Test
public void test_case_5() throws IOException {
public void test_case_5() {
if (isLessThanJdk17()) {
test_JavaCurrencyWrapperList(factory, factory);
try {
test_JavaCurrencyWrapperList(factory, factory);
} catch (Exception e) {
e.printStackTrace();
Assert.assertNull(e.getMessage(), e);
}
}
}

Expand All @@ -117,16 +142,26 @@ public void test_case_5() throws IOException {
* @throws IOException
*/
@Test
public void test_bytes_equals() throws IOException {
public void test_bytes_equals() {
if (isLessThanJdk17()) {
test_Serialize(originFactory, factory);
try {
test_Serialize(originFactory, factory);
} catch (Exception e) {
e.printStackTrace();
Assert.assertNull(e.getMessage(), e);
}
}
}

@Test
public void test_decode_encode_jdk17() throws IOException {
public void test_decode_encode_jdk17() {
if (!isLessThanJdk17()) {
test_JavaCurrencyWrapper(factory, factory);
try {
test_JavaCurrencyWrapper(factory, factory);
} catch (Exception e) {
e.printStackTrace();
Assert.assertNull(e.getMessage(), e);
}
}

}
Expand All @@ -151,7 +186,7 @@ private void test_JavaCurrencyWrapper(SerializerFactory serialize, SerializerFac
throws IOException {
if (isLessThanJdk17()) {
CurrencyWrapper cw = new CurrencyWrapper();
cw.setCurrency(Currency.getInstance(Locale.getDefault()));
cw.setCurrency(Currency.getInstance(Locale.SIMPLIFIED_CHINESE));

Object result = doEncodeNDecode(cw, serialize, deserialize);
Assert.assertTrue(result instanceof CurrencyWrapper);
Expand All @@ -163,7 +198,7 @@ private void test_JavaCurrencyWrapper(SerializerFactory serialize, SerializerFac
private void test_JavaCurrencyDirectly(SerializerFactory serialize, SerializerFactory deserialize)
throws IOException {
if (isLessThanJdk17()) {
Currency origin = Currency.getInstance(Locale.getDefault());
Currency origin = Currency.getInstance(Locale.SIMPLIFIED_CHINESE);

Object result = doEncodeNDecode(origin, serialize, deserialize);
Assert.assertTrue(result instanceof Currency);
Expand Down Expand Up @@ -191,7 +226,7 @@ private void test_JavaCurrencyWrapperList(SerializerFactory serialize, Serialize
private void test_Serialize(SerializerFactory originFactory, SerializerFactory newFactory)
throws IOException {
CurrencyWrapper cw = new CurrencyWrapper();
cw.setCurrency(Currency.getInstance(Locale.getDefault()));
cw.setCurrency(Currency.getInstance(Locale.SIMPLIFIED_CHINESE));

byte[] resultOrigin = doSerialize(cw, originFactory);
byte[] resultNew = doSerialize(cw, factory);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@

import com.caucho.hessian.io.Deserializer;
import com.caucho.hessian.io.HessianProtocolException;
import com.caucho.hessian.io.JavaDeserializer;
import com.caucho.hessian.io.JavaSerializer;
import com.caucho.hessian.io.Serializer;
import com.caucho.hessian.io.SerializerFactory;

Expand Down

0 comments on commit f25f4e0

Please sign in to comment.