Search in sources :

Example 16 with MarshallingConfiguration

use of org.jboss.marshalling.MarshallingConfiguration in project netty by netty.

the class AbstractCompatibleMarshallingDecoderTest method testSimpleUnmarshalling.

@Test
public void testSimpleUnmarshalling() throws IOException {
    MarshallerFactory marshallerFactory = createMarshallerFactory();
    MarshallingConfiguration configuration = createMarshallingConfig();
    EmbeddedChannel ch = new EmbeddedChannel(createDecoder(Integer.MAX_VALUE));
    ByteArrayOutputStream bout = new ByteArrayOutputStream();
    Marshaller marshaller = marshallerFactory.createMarshaller(configuration);
    marshaller.start(Marshalling.createByteOutput(bout));
    marshaller.writeObject(testObject);
    marshaller.finish();
    marshaller.close();
    byte[] testBytes = bout.toByteArray();
    ch.writeInbound(input(testBytes));
    assertTrue(ch.finish());
    String unmarshalled = ch.readInbound();
    assertEquals(testObject, unmarshalled);
    assertNull(ch.readInbound());
}
Also used : MarshallerFactory(org.jboss.marshalling.MarshallerFactory) Marshaller(org.jboss.marshalling.Marshaller) MarshallingConfiguration(org.jboss.marshalling.MarshallingConfiguration) EmbeddedChannel(io.netty.channel.embedded.EmbeddedChannel) ByteArrayOutputStream(java.io.ByteArrayOutputStream) Test(org.junit.jupiter.api.Test)

Example 17 with MarshallingConfiguration

use of org.jboss.marshalling.MarshallingConfiguration in project netty by netty.

the class SerialCompatibleMarshallingEncoderTest method createMarshallingConfig.

@Override
protected MarshallingConfiguration createMarshallingConfig() {
    // Create a configuration
    final MarshallingConfiguration configuration = new MarshallingConfiguration();
    configuration.setVersion(5);
    return configuration;
}
Also used : MarshallingConfiguration(org.jboss.marshalling.MarshallingConfiguration)

Aggregations

MarshallingConfiguration (org.jboss.marshalling.MarshallingConfiguration)17 MarshallerFactory (org.jboss.marshalling.MarshallerFactory)6 RiverMarshallerFactory (org.jboss.marshalling.river.RiverMarshallerFactory)5 EmbeddedChannel (io.netty.channel.embedded.EmbeddedChannel)4 ByteArrayOutputStream (java.io.ByteArrayOutputStream)4 Test (org.junit.jupiter.api.Test)4 IOException (java.io.IOException)3 Marshaller (org.jboss.marshalling.Marshaller)3 ByteBuf (io.netty.buffer.ByteBuf)2 ClassExternalizerFactory (org.jboss.marshalling.ClassExternalizerFactory)2 ObjectTable (org.jboss.marshalling.ObjectTable)2 SerializabilityChecker (org.jboss.marshalling.SerializabilityChecker)2 ZeroPortPolicy (com.sun.corba.se.spi.extension.ZeroPortPolicy)1 ChannelHandler (io.netty.channel.ChannelHandler)1 ByteArrayInputStream (java.io.ByteArrayInputStream)1 File (java.io.File)1 InvalidClassException (java.io.InvalidClassException)1 ArrayList (java.util.ArrayList)1 TransactionManager (javax.transaction.TransactionManager)1 EJBComponent (org.jboss.as.ejb3.component.EJBComponent)1