mirror of
https://gitee.com/willfree/min-dev-java.git
synced 2026-10-04 19:42:01 +08:00
fixed bug: tmplen+= => tmplen= & writing test: ControlParameter*
This commit is contained in:
1 parent
64c69acffc
commit
7c58530309
25 files changed
+299
-36
No files matched your search
@@ -62,14 +62,14 @@ public class CongestionMark implements TlvComponentBase, InitialAble, IEncodingA
|
||||
totalLength += tmplen;
|
||||
|
||||
// 编码 TLV-LENGTH
|
||||
tmplen += encoder.prependVarNumber(new VlInt(totalLength));
|
||||
tmplen = encoder.prependVarNumber(new VlInt(totalLength));
|
||||
if (tmplen < 0) {
|
||||
return -1;
|
||||
}
|
||||
totalLength += tmplen;
|
||||
|
||||
// 编码 TLV-TYPE
|
||||
tmplen += encoder.prependVarNumber(new VlInt(TLV.TlvCongestionMark));
|
||||
tmplen = encoder.prependVarNumber(new VlInt(TLV.TlvCongestionMark));
|
||||
if (tmplen < 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -63,14 +63,14 @@ public class ControlParameterCapacity implements TlvComponentBase,InitialAble, I
|
||||
totalLength += tmplen;
|
||||
|
||||
// 编码 TLV-LENGTH
|
||||
tmplen += encoder.prependVarNumber(new VlInt(totalLength));
|
||||
tmplen = encoder.prependVarNumber(new VlInt(totalLength));
|
||||
if (tmplen < 0) {
|
||||
return -1;
|
||||
}
|
||||
totalLength += tmplen;
|
||||
|
||||
// 编码 TLV-TYPE
|
||||
tmplen += encoder.prependVarNumber(new VlInt(TLV.TlvManagementCapacity));
|
||||
tmplen = encoder.prependVarNumber(new VlInt(TLV.TlvManagementCapacity));
|
||||
if (tmplen < 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -61,14 +61,14 @@ public class ControlParameterCost implements TlvComponentBase,InitialAble,IEncod
|
||||
totalLength += tmplen;
|
||||
|
||||
// 编码 TLV-LENGTH
|
||||
tmplen += encoder.prependVarNumber(new VlInt(totalLength));
|
||||
tmplen = encoder.prependVarNumber(new VlInt(totalLength));
|
||||
if (tmplen < 0) {
|
||||
return -1;
|
||||
}
|
||||
totalLength += tmplen;
|
||||
|
||||
// 编码 TLV-TYPE
|
||||
tmplen += encoder.prependVarNumber(new VlInt(TLV.TlvManagementCost));
|
||||
tmplen = encoder.prependVarNumber(new VlInt(TLV.TlvManagementCost));
|
||||
if (tmplen < 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -61,14 +61,14 @@ public class ControlParameterCount implements TlvComponentBase,InitialAble, IEnc
|
||||
totalLength += tmplen;
|
||||
|
||||
// 编码 TLV-LENGTH
|
||||
tmplen += encoder.prependVarNumber(new VlInt(totalLength));
|
||||
tmplen = encoder.prependVarNumber(new VlInt(totalLength));
|
||||
if (tmplen < 0) {
|
||||
return -1;
|
||||
}
|
||||
totalLength += tmplen;
|
||||
|
||||
// 编码 TLV-TYPE
|
||||
tmplen += encoder.prependVarNumber(new VlInt(TLV.TlvManagementCount));
|
||||
tmplen = encoder.prependVarNumber(new VlInt(TLV.TlvManagementCount));
|
||||
if (tmplen < 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -61,14 +61,14 @@ public class ControlParameterExpireTime implements TlvComponentBase,InitialAble,
|
||||
totalLength += tmplen;
|
||||
|
||||
// 编码 TLV-LENGTH
|
||||
tmplen += encoder.prependVarNumber(new VlInt(totalLength));
|
||||
tmplen = encoder.prependVarNumber(new VlInt(totalLength));
|
||||
if (tmplen < 0) {
|
||||
return -1;
|
||||
}
|
||||
totalLength += tmplen;
|
||||
|
||||
// 编码 TLV-TYPE
|
||||
tmplen += encoder.prependVarNumber(new VlInt(TLV.TlvManagementExpireTime));
|
||||
tmplen = encoder.prependVarNumber(new VlInt(TLV.TlvManagementExpireTime));
|
||||
if (tmplen < 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -65,14 +65,14 @@ public class ControlParameterLocalUri implements TlvComponentBase, InitialAble,
|
||||
totalLength += tmplen;
|
||||
|
||||
// 编码 TLV-LENGTH
|
||||
tmplen += encoder.prependVarNumber(new VlInt(totalLength));
|
||||
tmplen = encoder.prependVarNumber(new VlInt(totalLength));
|
||||
if (tmplen < 0) {
|
||||
return -1;
|
||||
}
|
||||
totalLength += tmplen;
|
||||
|
||||
// 编码 TLV-TYPE
|
||||
tmplen += encoder.prependVarNumber(new VlInt(TLV.TlvManagementLocalUri));
|
||||
tmplen = encoder.prependVarNumber(new VlInt(TLV.TlvManagementLocalUri));
|
||||
if (tmplen < 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -61,14 +61,14 @@ public class ControlParameterLogicFaceId implements TlvComponentBase,InitialAble
|
||||
totalLength += tmplen;
|
||||
|
||||
// 编码 TLV-LENGTH
|
||||
tmplen += encoder.prependVarNumber(new VlInt(totalLength));
|
||||
tmplen = encoder.prependVarNumber(new VlInt(totalLength));
|
||||
if (tmplen < 0) {
|
||||
return -1;
|
||||
}
|
||||
totalLength += tmplen;
|
||||
|
||||
// 编码 TLV-TYPE
|
||||
tmplen += encoder.prependVarNumber(new VlInt(TLV.TlvManagementLogicFaceId));
|
||||
tmplen = encoder.prependVarNumber(new VlInt(TLV.TlvManagementLogicFaceId));
|
||||
if (tmplen < 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -61,14 +61,14 @@ public class ControlParameterLogicFacePersistency implements TlvComponentBase,In
|
||||
totalLength += tmplen;
|
||||
|
||||
// 编码 TLV-LENGTH
|
||||
tmplen += encoder.prependVarNumber(new VlInt(totalLength));
|
||||
tmplen = encoder.prependVarNumber(new VlInt(totalLength));
|
||||
if (tmplen < 0) {
|
||||
return -1;
|
||||
}
|
||||
totalLength += tmplen;
|
||||
|
||||
// 编码 TLV-TYPE
|
||||
tmplen += encoder.prependVarNumber(new VlInt(TLV.TlvManagementLogicFacePersistency));
|
||||
tmplen = encoder.prependVarNumber(new VlInt(TLV.TlvManagementLogicFacePersistency));
|
||||
if (tmplen < 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -58,20 +58,23 @@ public class ControlParameterMtu implements TlvComponentBase,InitialAble,IEncodi
|
||||
if (tmplen < 0) {
|
||||
return -1;
|
||||
}
|
||||
System.out.println("tmplen-1: "+tmplen);
|
||||
totalLength += tmplen;
|
||||
|
||||
// 编码 TLV-LENGTH
|
||||
tmplen += encoder.prependVarNumber(new VlInt(totalLength));
|
||||
tmplen = encoder.prependVarNumber(new VlInt(totalLength));
|
||||
if (tmplen < 0) {
|
||||
return -1;
|
||||
}
|
||||
System.out.println("tmplen-2: "+tmplen);
|
||||
totalLength += tmplen;
|
||||
|
||||
// 编码 TLV-TYPE
|
||||
tmplen += encoder.prependVarNumber(new VlInt(TLV.TlvManagementMtu));
|
||||
tmplen = encoder.prependVarNumber(new VlInt(TLV.TlvManagementMtu));
|
||||
if (tmplen < 0) {
|
||||
return -1;
|
||||
}
|
||||
System.out.println("tmplen-3: "+tmplen);
|
||||
totalLength += tmplen;
|
||||
|
||||
return totalLength;
|
||||
|
||||
@@ -61,14 +61,14 @@ public class ControlParameterPrefix implements TlvComponentBase,InitialAble, IEn
|
||||
totalLength += tmplen;
|
||||
|
||||
// 编码 TLV-LENGTH
|
||||
tmplen += encoder.prependVarNumber(new VlInt(totalLength));
|
||||
tmplen = encoder.prependVarNumber(new VlInt(totalLength));
|
||||
if (tmplen < 0) {
|
||||
return -1;
|
||||
}
|
||||
totalLength += tmplen;
|
||||
|
||||
// 编码 TLV-TYPE
|
||||
tmplen += encoder.prependVarNumber(new VlInt(TLV.TlvManagementPrefix));
|
||||
tmplen = encoder.prependVarNumber(new VlInt(TLV.TlvManagementPrefix));
|
||||
if (tmplen < 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -65,14 +65,14 @@ public class ControlParameterUri implements TlvComponentBase, InitialAble, IEnco
|
||||
totalLength += tmplen;
|
||||
|
||||
// 编码 TLV-LENGTH
|
||||
tmplen += encoder.prependVarNumber(new VlInt(totalLength));
|
||||
tmplen = encoder.prependVarNumber(new VlInt(totalLength));
|
||||
if (tmplen < 0) {
|
||||
return -1;
|
||||
}
|
||||
totalLength += tmplen;
|
||||
|
||||
// 编码 TLV-TYPE
|
||||
tmplen += encoder.prependVarNumber(new VlInt(TLV.TlvManagementUri));
|
||||
tmplen = encoder.prependVarNumber(new VlInt(TLV.TlvManagementUri));
|
||||
if (tmplen < 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -61,14 +61,14 @@ public class ControlParameterUriScheme implements TlvComponentBase,InitialAble,I
|
||||
totalLength += tmplen;
|
||||
|
||||
// 编码 TLV-LENGTH
|
||||
tmplen += encoder.prependVarNumber(new VlInt(totalLength));
|
||||
tmplen = encoder.prependVarNumber(new VlInt(totalLength));
|
||||
if (tmplen < 0) {
|
||||
return -1;
|
||||
}
|
||||
totalLength += tmplen;
|
||||
|
||||
// 编码 TLV-TYPE
|
||||
tmplen += encoder.prependVarNumber(new VlInt(TLV.TlvManagementUriScheme));
|
||||
tmplen = encoder.prependVarNumber(new VlInt(TLV.TlvManagementUriScheme));
|
||||
if (tmplen < 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -63,14 +63,14 @@ public class FreshnessPeriod implements TlvComponentBase, InitialAble, IEncoding
|
||||
totalLength += tmplen;
|
||||
|
||||
// 编码 TLV-LENGTH
|
||||
tmplen += encoder.prependVarNumber(new VlInt(totalLength));
|
||||
tmplen = encoder.prependVarNumber(new VlInt(totalLength));
|
||||
if (tmplen < 0) {
|
||||
return -1;
|
||||
}
|
||||
totalLength += tmplen;
|
||||
|
||||
// 编码 TLV-TYPE
|
||||
tmplen += encoder.prependVarNumber(new VlInt(TLV.TlvFreshnessPeriod));
|
||||
tmplen = encoder.prependVarNumber(new VlInt(TLV.TlvFreshnessPeriod));
|
||||
if (tmplen < 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -62,14 +62,14 @@ public class HopLimit implements TlvComponentBase,InitialAble, IEncodingAble {
|
||||
totalLength += tmplen;
|
||||
|
||||
// 编码 TLV-LENGTH
|
||||
tmplen += encoder.prependVarNumber(new VlInt(totalLength));
|
||||
tmplen = encoder.prependVarNumber(new VlInt(totalLength));
|
||||
if (tmplen < 0) {
|
||||
return -1;
|
||||
}
|
||||
totalLength += tmplen;
|
||||
|
||||
// 编码 TLV-TYPE
|
||||
tmplen += encoder.prependVarNumber(new VlInt(TLV.TlvHopLimit));
|
||||
tmplen = encoder.prependVarNumber(new VlInt(TLV.TlvHopLimit));
|
||||
if (tmplen < 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -63,14 +63,14 @@ public class InterestLifeTime implements TlvComponentBase,InitialAble, IEncoding
|
||||
totalLength += tmplen;
|
||||
|
||||
// 编码 TLV-LENGTH
|
||||
tmplen += encoder.prependVarNumber(new VlInt(totalLength));
|
||||
tmplen = encoder.prependVarNumber(new VlInt(totalLength));
|
||||
if (tmplen < 0) {
|
||||
return -1;
|
||||
}
|
||||
totalLength += tmplen;
|
||||
|
||||
// 编码 TLV-TYPE
|
||||
tmplen += encoder.prependVarNumber(new VlInt(TLV.TlvInterestLifeTime));
|
||||
tmplen = encoder.prependVarNumber(new VlInt(TLV.TlvInterestLifeTime));
|
||||
if (tmplen < 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -66,14 +66,14 @@ public class NackHeader implements TlvComponentBase,InitialAble, IEncodingAble {
|
||||
totalLength += tmplen;
|
||||
|
||||
// 编码 TLV-LENGTH
|
||||
tmplen += encoder.prependVarNumber(new VlInt(totalLength));
|
||||
tmplen = encoder.prependVarNumber(new VlInt(totalLength));
|
||||
if (tmplen < 0) {
|
||||
return -1;
|
||||
}
|
||||
totalLength += tmplen;
|
||||
|
||||
// 编码 TLV-TYPE
|
||||
tmplen += encoder.prependVarNumber(new VlInt(TLV.TlvNackHeader));
|
||||
tmplen = encoder.prependVarNumber(new VlInt(TLV.TlvNackHeader));
|
||||
if (tmplen < 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -73,14 +73,14 @@ public class Nonce implements TlvComponentBase, InitialAble, IEncodingAble {
|
||||
totalLength += tmplen;
|
||||
|
||||
// 编码 TLV-LENGTH
|
||||
tmplen += encoder.prependVarNumber(new VlInt(totalLength));
|
||||
tmplen = encoder.prependVarNumber(new VlInt(totalLength));
|
||||
if (tmplen < 0) {
|
||||
return -1;
|
||||
}
|
||||
totalLength += tmplen;
|
||||
|
||||
// 编码 TLV-TYPE
|
||||
tmplen += encoder.prependVarNumber(new VlInt(TLV.TlvNonce));
|
||||
tmplen = encoder.prependVarNumber(new VlInt(TLV.TlvNonce));
|
||||
if (tmplen < 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -89,14 +89,14 @@ public class Payload implements TlvComponentBase,InitialAble, IEncodingAble {
|
||||
totalLength += tmplen;
|
||||
|
||||
// 编码 TLV-LENGTH
|
||||
tmplen += encoder.prependVarNumber(new VlInt(totalLength));
|
||||
tmplen = encoder.prependVarNumber(new VlInt(totalLength));
|
||||
if (tmplen < 0) {
|
||||
return -1;
|
||||
}
|
||||
totalLength += tmplen;
|
||||
|
||||
// 编码 TLV-TYPE
|
||||
tmplen += encoder.prependVarNumber(new VlInt(TLV.TlvPayload));
|
||||
tmplen = encoder.prependVarNumber(new VlInt(TLV.TlvPayload));
|
||||
if (tmplen < 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
package component;
|
||||
|
||||
import encoding.*;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
/*
|
||||
* @Author: Wang Feng
|
||||
* @Description:
|
||||
* @Version: 1.0.0
|
||||
* @Date: 14:03 2021/4/8
|
||||
* @Copyright: MIN-Group;国家重大科技基础设施——未来网络北大实验室;深圳市信息论与未来网络重点实验室
|
||||
*/
|
||||
public class ControlParameterCountTest {
|
||||
@Test
|
||||
public void testControlParameterCountEncoderAndDecode() throws EncoderException, ComponentException, BlockException {
|
||||
ControlParameterCount controlParameterCount=new ControlParameterCount(Long.MAX_VALUE);
|
||||
System.out.println("value: "+controlParameterCount.getCount());
|
||||
System.out.println("ini: "+controlParameterCount.isInitial());
|
||||
|
||||
Encoder encoder = new Encoder();
|
||||
encoder.encoderReset(new SizeT(Encoder.MaxPacketSize), new SizeT(0));
|
||||
System.out.println("encode res: "+controlParameterCount.wireEncode(encoder));
|
||||
byte[] buf=encoder.getBuffer();
|
||||
System.out.println("buf: "+ Arrays.toString(buf));
|
||||
|
||||
Block block=new Block(buf,false);
|
||||
ControlParameterCount controlParameterCount1=new ControlParameterCount();
|
||||
System.out.println("decode res: "+controlParameterCount1.wireDecode(block));
|
||||
System.out.println("new value: "+controlParameterCount1.getCount());
|
||||
System.out.println("new ini: "+controlParameterCount1.isInitial());
|
||||
encoder.encoderReset(new SizeT(Encoder.MaxPacketSize), new SizeT(0));
|
||||
controlParameterCount1.wireEncode(encoder);
|
||||
System.out.println("new buf: "+Arrays.toString(encoder.getBuffer()));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package component;
|
||||
|
||||
import encoding.*;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
/*
|
||||
* @Author: Wang Feng
|
||||
* @Description:
|
||||
* @Version: 1.0.0
|
||||
* @Date: 14:03 2021/4/8
|
||||
* @Copyright: MIN-Group;国家重大科技基础设施——未来网络北大实验室;深圳市信息论与未来网络重点实验室
|
||||
*/
|
||||
public class ControlParameterExpireTimeTest {
|
||||
@Test
|
||||
public void testControlParameterExpireTimeEncoderAndDecode() throws EncoderException, ComponentException, BlockException {
|
||||
ControlParameterExpireTime controlParameterExpireTime=new ControlParameterExpireTime(Long.MAX_VALUE);
|
||||
System.out.println("value: "+controlParameterExpireTime.getExpireTime());
|
||||
System.out.println("ini: "+controlParameterExpireTime.isInitial());
|
||||
|
||||
Encoder encoder = new Encoder();
|
||||
encoder.encoderReset(new SizeT(Encoder.MaxPacketSize), new SizeT(0));
|
||||
System.out.println("encode res: "+controlParameterExpireTime.wireEncode(encoder));
|
||||
byte[] buf=encoder.getBuffer();
|
||||
System.out.println("buf: "+ Arrays.toString(buf));
|
||||
|
||||
Block block=new Block(buf,false);
|
||||
ControlParameterExpireTime controlParameterExpireTime1=new ControlParameterExpireTime();
|
||||
System.out.println("decode res: "+controlParameterExpireTime1.wireDecode(block));
|
||||
System.out.println("new value: "+controlParameterExpireTime1.getExpireTime());
|
||||
System.out.println("new ini: "+controlParameterExpireTime1.isInitial());
|
||||
encoder.encoderReset(new SizeT(Encoder.MaxPacketSize), new SizeT(0));
|
||||
controlParameterExpireTime1.wireEncode(encoder);
|
||||
System.out.println("new buf: "+Arrays.toString(encoder.getBuffer()));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package component;
|
||||
|
||||
import encoding.*;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
/*
|
||||
* @Author: Wang Feng
|
||||
* @Description:
|
||||
* @Version: 1.0.0
|
||||
* @Date: 14:03 2021/4/8
|
||||
* @Copyright: MIN-Group;国家重大科技基础设施——未来网络北大实验室;深圳市信息论与未来网络重点实验室
|
||||
*/
|
||||
public class ControlParameterLocalUriTest {
|
||||
@Test
|
||||
public void testControlParameterLocalUriEncoderAndDecode() throws EncoderException, ComponentException, BlockException {
|
||||
ControlParameterLocalUri controlParameterCost=new ControlParameterLocalUri("wefree");
|
||||
System.out.println("value: "+controlParameterCost.getLocalUri());
|
||||
System.out.println("ini: "+controlParameterCost.isInitial());
|
||||
|
||||
Encoder encoder = new Encoder();
|
||||
encoder.encoderReset(new SizeT(Encoder.MaxPacketSize), new SizeT(0));
|
||||
System.out.println("encode res: "+controlParameterCost.wireEncode(encoder));
|
||||
byte[] buf=encoder.getBuffer();
|
||||
System.out.println("buf: "+ Arrays.toString(buf));
|
||||
System.out.println("buf len: "+buf.length);
|
||||
|
||||
Block block=new Block(buf,false);
|
||||
ControlParameterLocalUri controlParameterCost1=new ControlParameterLocalUri();
|
||||
System.out.println("decode res: "+controlParameterCost1.wireDecode(block));
|
||||
System.out.println("new value: "+controlParameterCost1.getLocalUri());
|
||||
System.out.println("new ini: "+controlParameterCost1.isInitial());
|
||||
encoder.encoderReset(new SizeT(Encoder.MaxPacketSize), new SizeT(0));
|
||||
controlParameterCost1.wireEncode(encoder);
|
||||
System.out.println("new buf: "+Arrays.toString(encoder.getBuffer()));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package component;
|
||||
|
||||
import encoding.*;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
/*
|
||||
* @Author: Wang Feng
|
||||
* @Description:
|
||||
* @Version: 1.0.0
|
||||
* @Date: 14:03 2021/4/8
|
||||
* @Copyright: MIN-Group;国家重大科技基础设施——未来网络北大实验室;深圳市信息论与未来网络重点实验室
|
||||
*/
|
||||
public class ControlParameterLogicFaceIdTest {
|
||||
@Test
|
||||
public void testControlParameterLogicFaceIdEncoderAndDecode() throws EncoderException, ComponentException, BlockException {
|
||||
ControlParameterLogicFaceId controlParameterLogicFaceId=new ControlParameterLogicFaceId(Long.MAX_VALUE);
|
||||
System.out.println("value: "+controlParameterLogicFaceId.getLogicFaceId());
|
||||
System.out.println("ini: "+controlParameterLogicFaceId.isInitial());
|
||||
|
||||
Encoder encoder = new Encoder();
|
||||
encoder.encoderReset(new SizeT(Encoder.MaxPacketSize), new SizeT(0));
|
||||
System.out.println("encode res: "+controlParameterLogicFaceId.wireEncode(encoder));
|
||||
byte[] buf=encoder.getBuffer();
|
||||
System.out.println("buf: "+ Arrays.toString(buf));
|
||||
|
||||
Block block=new Block(buf,false);
|
||||
ControlParameterLogicFaceId controlParameterLogicFaceId1=new ControlParameterLogicFaceId();
|
||||
System.out.println("decode res: "+controlParameterLogicFaceId1.wireDecode(block));
|
||||
System.out.println("new value: "+controlParameterLogicFaceId1.getLogicFaceId());
|
||||
System.out.println("new ini: "+controlParameterLogicFaceId1.isInitial());
|
||||
encoder.encoderReset(new SizeT(Encoder.MaxPacketSize), new SizeT(0));
|
||||
controlParameterLogicFaceId1.wireEncode(encoder);
|
||||
System.out.println("new buf: "+Arrays.toString(encoder.getBuffer()));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package component;
|
||||
|
||||
import encoding.*;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
/*
|
||||
* @Author: Wang Feng
|
||||
* @Description:
|
||||
* @Version: 1.0.0
|
||||
* @Date: 14:03 2021/4/8
|
||||
* @Copyright: MIN-Group;国家重大科技基础设施——未来网络北大实验室;深圳市信息论与未来网络重点实验室
|
||||
*/
|
||||
public class ControlParameterLogicFacePersistencyTest {
|
||||
@Test
|
||||
public void testControlParameterLogicFacePersistencyEncoderAndDecode() throws EncoderException, ComponentException, BlockException {
|
||||
ControlParameterLogicFacePersistency controlParameterLogicFacePersistency=new ControlParameterLogicFacePersistency(Long.MAX_VALUE);
|
||||
System.out.println("value: "+controlParameterLogicFacePersistency.getPersistency());
|
||||
System.out.println("ini: "+controlParameterLogicFacePersistency.isInitial());
|
||||
|
||||
Encoder encoder = new Encoder();
|
||||
encoder.encoderReset(new SizeT(Encoder.MaxPacketSize), new SizeT(0));
|
||||
System.out.println("encode res: "+controlParameterLogicFacePersistency.wireEncode(encoder));
|
||||
byte[] buf=encoder.getBuffer();
|
||||
System.out.println("buf: "+ Arrays.toString(buf));
|
||||
|
||||
Block block=new Block(buf,false);
|
||||
ControlParameterLogicFacePersistency controlParameterLogicFacePersistency1=new ControlParameterLogicFacePersistency();
|
||||
System.out.println("decode res: "+controlParameterLogicFacePersistency1.wireDecode(block));
|
||||
System.out.println("new value: "+controlParameterLogicFacePersistency1.getPersistency());
|
||||
System.out.println("new ini: "+controlParameterLogicFacePersistency1.isInitial());
|
||||
encoder.encoderReset(new SizeT(Encoder.MaxPacketSize), new SizeT(0));
|
||||
controlParameterLogicFacePersistency1.wireEncode(encoder);
|
||||
System.out.println("new buf: "+Arrays.toString(encoder.getBuffer()));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package component;
|
||||
|
||||
import encoding.*;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
/*
|
||||
* @Author: Wang Feng
|
||||
* @Description:
|
||||
* @Version: 1.0.0
|
||||
* @Date: 14:03 2021/4/8
|
||||
* @Copyright: MIN-Group;国家重大科技基础设施——未来网络北大实验室;深圳市信息论与未来网络重点实验室
|
||||
*/
|
||||
public class ControlParameterMtuTest {
|
||||
@Test
|
||||
public void testControlParameterMtuEncoderAndDecode() throws EncoderException, ComponentException, BlockException {
|
||||
ControlParameterMtu controlParameterMtu=new ControlParameterMtu(Long.MAX_VALUE);
|
||||
System.out.println("value: "+controlParameterMtu.getMtu());
|
||||
System.out.println("ini: "+controlParameterMtu.isInitial());
|
||||
|
||||
Encoder encoder = new Encoder();
|
||||
encoder.encoderReset(new SizeT(Encoder.MaxPacketSize), new SizeT(0));
|
||||
System.out.println("encode res: "+controlParameterMtu.wireEncode(encoder));
|
||||
byte[] buf=encoder.getBuffer();
|
||||
System.out.println("buf: "+ Arrays.toString(buf));
|
||||
|
||||
Block block=new Block(buf,false);
|
||||
ControlParameterMtu controlParameterMtu1=new ControlParameterMtu();
|
||||
System.out.println("decode res: "+controlParameterMtu1.wireDecode(block));
|
||||
System.out.println("new value: "+controlParameterMtu1.getMtu());
|
||||
System.out.println("new ini: "+controlParameterMtu1.isInitial());
|
||||
encoder.encoderReset(new SizeT(Encoder.MaxPacketSize), new SizeT(0));
|
||||
controlParameterMtu1.wireEncode(encoder);
|
||||
System.out.println("new buf: "+Arrays.toString(encoder.getBuffer()));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package component;
|
||||
|
||||
import encoding.*;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
/*
|
||||
* @Author: Wang Feng
|
||||
* @Description:
|
||||
* @Version: 1.0.0
|
||||
* @Date: 14:03 2021/4/8
|
||||
* @Copyright: MIN-Group;国家重大科技基础设施——未来网络北大实验室;深圳市信息论与未来网络重点实验室
|
||||
*/
|
||||
public class ControlParameterUriSchemeTest {
|
||||
@Test
|
||||
public void testControlParameterUriSchemeEncoderAndDecode() throws EncoderException, ComponentException, BlockException {
|
||||
ControlParameterUriScheme controlParameterUriScheme=new ControlParameterUriScheme(Long.MAX_VALUE);
|
||||
System.out.println("value: "+controlParameterUriScheme.getUriScheme());
|
||||
System.out.println("ini: "+controlParameterUriScheme.isInitial());
|
||||
|
||||
Encoder encoder = new Encoder();
|
||||
encoder.encoderReset(new SizeT(Encoder.MaxPacketSize), new SizeT(0));
|
||||
System.out.println("encode res: "+controlParameterUriScheme.wireEncode(encoder));
|
||||
byte[] buf=encoder.getBuffer();
|
||||
System.out.println("buf: "+ Arrays.toString(buf));
|
||||
|
||||
Block block=new Block(buf,false);
|
||||
ControlParameterUriScheme controlParameterUriScheme1=new ControlParameterUriScheme();
|
||||
System.out.println("decode res: "+controlParameterUriScheme1.wireDecode(block));
|
||||
System.out.println("new value: "+controlParameterUriScheme1.getUriScheme());
|
||||
System.out.println("new ini: "+controlParameterUriScheme1.isInitial());
|
||||
encoder.encoderReset(new SizeT(Encoder.MaxPacketSize), new SizeT(0));
|
||||
controlParameterUriScheme1.wireEncode(encoder);
|
||||
System.out.println("new buf: "+Arrays.toString(encoder.getBuffer()));
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user