Skip to content

Commit

Permalink
Merge pull request #167 from alibaba/develop20210614
Browse files Browse the repository at this point in the history
update sandbox version
  • Loading branch information
zhaoyb1990 authored Feb 24, 2022
2 parents 8c2dc27 + a0b8ec7 commit c48003e
Show file tree
Hide file tree
Showing 8 changed files with 64 additions and 5 deletions.
2 changes: 1 addition & 1 deletion bin/install-local.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ exit_on_err()
sh ./package.sh || exit_on_err 1 "install failed cause package failed"

# extract sandbox to ${HOME}
curl -s http://sandbox-ecological.oss-cn-hangzhou.aliyuncs.com/sandbox-1.2.1-bin.tar | tar xz -C ${HOME} || exit_on_err 1 "extract sandbox failed"
curl -s http://sandbox-ecological.oss-cn-hangzhou.aliyuncs.com/sandbox-1.3.3-bin.tar | tar xz -C ${HOME} || exit_on_err 1 "extract sandbox failed"

# copy module to ~/.sandbox-module
mkdir -p ${HOME}/.sandbox-module || exit_on_err 1 "permission denied, can not mkdir ~/.sandbox-module"
Expand Down
2 changes: 1 addition & 1 deletion bin/install-repeater.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ exit_on_err()
main(){
echo "====== begin to install sandbox and repeater module ======";
echo "====== step 0 begin to download sandbox package ======";
curl -s http://sandbox-ecological.oss-cn-hangzhou.aliyuncs.com/sandbox-1.2.1-bin.tar | tar xz -C ${HOME} || exit_on_err 1 "extract sandbox failed"
curl -s http://sandbox-ecological.oss-cn-hangzhou.aliyuncs.com/sandbox-1.3.3-bin.tar | tar xz -C ${HOME} || exit_on_err 1 "extract sandbox failed"
echo "====== step 1 begin to download repeater module package ======";
if [ ! -d ${MODULE_HOME} ]; then
mkdir -p ${MODULE_HOME} || exit_on_err 1 "permission denied mkdir ${MODULE_HOME}"
Expand Down
9 changes: 8 additions & 1 deletion bin/package.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,11 @@ cp ./repeater-logback.xml ${REPEATER_TARGET_DIR}/cfg/repeater-logback.xml \
&& cp ../repeater-plugins/redis-plugin/target/redis-plugin-*-jar-with-dependencies.jar ${REPEATER_TARGET_DIR}/plugins/redis-plugin.jar \
&& cp ../repeater-plugins/http-plugin/target/http-plugin-*-jar-with-dependencies.jar ${REPEATER_TARGET_DIR}/plugins/http-plugin.jar \
&& cp ../repeater-plugins/hibernate-plugin/target/hibernate-plugin-*-jar-with-dependencies.jar ${REPEATER_TARGET_DIR}/plugins/hibernate-plugin.jar \
&& cp ../repeater-plugins/spring-data-jpa-plugin/target/spring-data-jpa-plugin-*-jar-with-dependencies.jar ${REPEATER_TARGET_DIR}/plugins/spring-data-jpa-plugin.jar
&& cp ../repeater-plugins/spring-data-jpa-plugin/target/spring-data-jpa-plugin-*-jar-with-dependencies.jar ${REPEATER_TARGET_DIR}/plugins/spring-data-jpa-plugin.jar

# tar the repeater.tar
cd ../target/
tar -zcvf repeater-stable-bin.tar repeater/
cd -

echo "package repeater-stable-bin.zip finish."
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.util.ArrayList;
import java.util.Collections;
import java.util.WeakHashMap;
import java.util.logging.Level;
import java.util.logging.Logger;
Expand Down Expand Up @@ -141,7 +142,8 @@ protected void introspect(Class<?> cl)
ArrayList<Field> fields = new ArrayList<Field>();
fields.addAll(primitiveFields);
fields.addAll(compoundFields);

// 属性倒序,先写入父类属性,再写入子类属性,保证子类属性不被覆盖
Collections.reverse(fields);
_fields = new Field[fields.size()];
fields.toArray(_fields);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
import java.lang.reflect.Field;
import java.lang.reflect.Modifier;
import java.util.ArrayList;
import java.util.Collections;
import java.util.WeakHashMap;
import java.util.logging.Level;
import java.util.logging.Logger;
Expand Down Expand Up @@ -142,7 +143,8 @@ protected void introspect(Class<?> cl)
ArrayList<Field> fields = new ArrayList<Field>();
fields.addAll(primitiveFields);
fields.addAll(compoundFields);

// 属性倒序,先写入父类属性,再写入子类属性,保证子类属性不被覆盖
Collections.reverse(fields);
_fields = new Field[fields.size()];
fields.toArray(_fields);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ public BigDecimal getMoney() {
return money;
}

private String name = "parent";

public void setMoney(BigDecimal money) {
this.money = money;
}
Expand Down Expand Up @@ -54,6 +56,14 @@ public void setLocalDate(LocalDate localDate) {
this.localDate = localDate;
}

public String getName() {
return name;
}

public void setName(String name) {
this.name = name;
}

@Override
public boolean equals(Object o) {
if (this == o) return true;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package com.alibaba.jvm.sandbox.repeater.plugin.core.serialize;

/**
* {@link HessianSerializeDomainSub}
* <p>
*
* @author zhaoyb1990
*/
public class HessianSerializeDomainSub extends HessianSerializeDomain {

private String name = "son";

@Override
public String getName() {
return name;
}

@Override
public void setName(String name) {
this.name = name;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,20 @@ public void serialize() {
Assert.fail(e.getMessage());
}
}


@Test
public void deserialize() {
HessianSerializeDomainSub domain = new HessianSerializeDomainSub();
Serializer serializer = SerializerProvider.instance().provide(Serializer.Type.HESSIAN);
String sequence;
try {
sequence = serializer.serialize2String(domain);
Assert.assertNotNull(sequence);
HessianSerializeDomainSub deserialize = serializer.deserialize(sequence, HessianSerializeDomainSub.class);
Assert.assertEquals(domain, deserialize);
} catch (SerializeException e) {
Assert.fail(e.getMessage());
}
}
}

0 comments on commit c48003e

Please sign in to comment.