Search in sources :

Example 1 with ExtendedSequence

use of com.beanit.asn1bean.compiler.extension_test.non_extensible.ExtendedSequence in project jasn1 by openmuc.

the class ExtensibilityImpliedTest method computeCode.

@BeforeAll
static void computeCode() throws IOException {
    ReverseByteArrayOutputStream os = new ReverseByteArrayOutputStream(100, true);
    NonExtensibleSequence nonExtensibleSequence = new NonExtensibleSequence();
    nonExtensibleSequence.setAge(new BerInteger(5));
    os.reset();
    nonExtensibleSequence.encode(os);
    byte[] nonExtensibleSequenceCode = os.getArray();
    ExtendedSequence extendedSequence = new ExtendedSequence();
    extendedSequence.setAge(new BerInteger(5));
    extendedSequence.setName(new BerVisibleString("name"));
    extendedSequence.setSubAge(nonExtensibleSequence);
    os.reset();
    extendedSequence.encode(os);
    byte[] extendedSequenceCode = os.getArray();
    extensionCode = Arrays.copyOfRange(extendedSequenceCode, nonExtensibleSequenceCode.length, extendedSequenceCode.length);
    ExtendedSequenceAndMore extendedSequenceAndMore = new ExtendedSequenceAndMore();
    extendedSequenceAndMore.setExtendedSequence(extendedSequence);
    extendedSequenceAndMore.setMore(new BerVisibleString("more"));
    os.reset();
    extendedSequenceAndMore.encode(os);
    extendedSequenceAndMoreCode = os.getArray();
}
Also used : NonExtensibleSequence(com.beanit.asn1bean.compiler.extension_test.non_extensible.NonExtensibleSequence) BerVisibleString(com.beanit.asn1bean.ber.types.string.BerVisibleString) ExtendedSequenceAndMore(com.beanit.asn1bean.compiler.extension_test.non_extensible.ExtendedSequenceAndMore) BerInteger(com.beanit.asn1bean.ber.types.BerInteger) ExtendedSequence(com.beanit.asn1bean.compiler.extension_test.non_extensible.ExtendedSequence) ReverseByteArrayOutputStream(com.beanit.asn1bean.ber.ReverseByteArrayOutputStream) BeforeAll(org.junit.jupiter.api.BeforeAll)

Aggregations

ReverseByteArrayOutputStream (com.beanit.asn1bean.ber.ReverseByteArrayOutputStream)1 BerInteger (com.beanit.asn1bean.ber.types.BerInteger)1 BerVisibleString (com.beanit.asn1bean.ber.types.string.BerVisibleString)1 ExtendedSequence (com.beanit.asn1bean.compiler.extension_test.non_extensible.ExtendedSequence)1 ExtendedSequenceAndMore (com.beanit.asn1bean.compiler.extension_test.non_extensible.ExtendedSequenceAndMore)1 NonExtensibleSequence (com.beanit.asn1bean.compiler.extension_test.non_extensible.NonExtensibleSequence)1 BeforeAll (org.junit.jupiter.api.BeforeAll)1