Search in sources :

Example 1 with ExtensibleAccessSequenceAndMore

use of com.beanit.asn1bean.compiler.extension_test.extensible_with_access.ExtensibleAccessSequenceAndMore in project jasn1 by openmuc.

the class ExtensibilityImpliedTest method accessExtensionBytes.

@Test
void accessExtensionBytes() throws IOException {
    ExtensibleAccessSequenceAndMore extensibleSequenceAndMore = new ExtensibleAccessSequenceAndMore();
    extensibleSequenceAndMore.decode(new ByteArrayInputStream(extendedSequenceAndMoreCode));
    Assertions.assertEquals(5, extensibleSequenceAndMore.getExtensibleSequence().getAge().value.intValue());
    Assertions.assertEquals("more", extensibleSequenceAndMore.getMore().toString());
    Assertions.assertArrayEquals(extensionCode, extensibleSequenceAndMore.getExtensibleSequence().getExtensionBytes());
}
Also used : ByteArrayInputStream(java.io.ByteArrayInputStream) ExtensibleAccessSequenceAndMore(com.beanit.asn1bean.compiler.extension_test.extensible_with_access.ExtensibleAccessSequenceAndMore) Test(org.junit.jupiter.api.Test)

Example 2 with ExtensibleAccessSequenceAndMore

use of com.beanit.asn1bean.compiler.extension_test.extensible_with_access.ExtensibleAccessSequenceAndMore in project jasn1 by openmuc.

the class ExtensibilityImpliedTest method setExtensionBytes.

@Test
void setExtensionBytes() throws IOException {
    NonExtensibleSequence nonExtensibleSequence = new NonExtensibleSequence();
    nonExtensibleSequence.setAge(new BerInteger(5));
    ExtensibleAccessSequence extensibleSequence = new ExtensibleAccessSequence();
    extensibleSequence.setAge(new BerInteger(5));
    extensibleSequence.setExtensionBytes(extensionCode);
    ExtensibleAccessSequenceAndMore extensibleSequenceAndMore = new ExtensibleAccessSequenceAndMore();
    extensibleSequenceAndMore.setExtensibleSequence(extensibleSequence);
    extensibleSequenceAndMore.setMore(new BerVisibleString("more"));
    ReverseByteArrayOutputStream os = new ReverseByteArrayOutputStream(100, true);
    extensibleSequenceAndMore.encode(os);
    Assertions.assertArrayEquals(extendedSequenceAndMoreCode, os.getArray());
}
Also used : ExtensibleAccessSequence(com.beanit.asn1bean.compiler.extension_test.extensible_with_access.ExtensibleAccessSequence) ExtensibleAccessSequenceAndMore(com.beanit.asn1bean.compiler.extension_test.extensible_with_access.ExtensibleAccessSequenceAndMore) NonExtensibleSequence(com.beanit.asn1bean.compiler.extension_test.non_extensible.NonExtensibleSequence) BerVisibleString(com.beanit.asn1bean.ber.types.string.BerVisibleString) BerInteger(com.beanit.asn1bean.ber.types.BerInteger) ReverseByteArrayOutputStream(com.beanit.asn1bean.ber.ReverseByteArrayOutputStream) Test(org.junit.jupiter.api.Test)

Aggregations

ExtensibleAccessSequenceAndMore (com.beanit.asn1bean.compiler.extension_test.extensible_with_access.ExtensibleAccessSequenceAndMore)2 Test (org.junit.jupiter.api.Test)2 ReverseByteArrayOutputStream (com.beanit.asn1bean.ber.ReverseByteArrayOutputStream)1 BerInteger (com.beanit.asn1bean.ber.types.BerInteger)1 BerVisibleString (com.beanit.asn1bean.ber.types.string.BerVisibleString)1 ExtensibleAccessSequence (com.beanit.asn1bean.compiler.extension_test.extensible_with_access.ExtensibleAccessSequence)1 NonExtensibleSequence (com.beanit.asn1bean.compiler.extension_test.non_extensible.NonExtensibleSequence)1 ByteArrayInputStream (java.io.ByteArrayInputStream)1