use of com.hazelcast.internal.serialization.impl.DefaultSerializationServiceBuilder in project hazelcast by hazelcast.
the class TcpServerConnection_AbstractTest method setup.
@Before
public void setup() throws Exception {
loggingService = new LoggingServiceImpl("somegroup", "log4j2", BuildInfoProvider.getBuildInfo(), true, null);
logger = loggingService.getLogger(TcpServerConnection_AbstractTest.class);
metricsRegistryA = newMetricsRegistry();
tcpServerA = newMockTcpServer(metricsRegistryA);
serverContextA = (MockServerContext) tcpServerA.getContext();
addressA = serverContextA.getThisAddress();
metricsRegistryB = newMetricsRegistry();
tcpServerB = newMockTcpServer(metricsRegistryB);
serverContextB = (MockServerContext) tcpServerB.getContext();
addressB = serverContextB.getThisAddress();
metricsRegistryC = newMetricsRegistry();
tcpServerC = newMockTcpServer(metricsRegistryC);
serverContextC = (MockServerContext) tcpServerC.getContext();
addressC = serverContextC.getThisAddress();
serializationService = new DefaultSerializationServiceBuilder().addDataSerializableFactory(TestDataFactory.FACTORY_ID, new TestDataFactory()).build();
}
use of com.hazelcast.internal.serialization.impl.DefaultSerializationServiceBuilder in project hazelcast by hazelcast.
the class CollectionUtilTest method testObjectToDataCollection_size.
@Test
public void testObjectToDataCollection_size() {
SerializationService serializationService = new DefaultSerializationServiceBuilder().build();
Collection<Object> list = new ArrayList<Object>();
list.add(1);
list.add("foo");
Collection<Data> dataCollection = objectToDataCollection(list, serializationService);
assertEquals(list.size(), dataCollection.size());
}
use of com.hazelcast.internal.serialization.impl.DefaultSerializationServiceBuilder in project hazelcast by hazelcast.
the class ClientDelegatingFuture_SerializationExceptionTest method setup.
@Before
public void setup() {
serializationService = new DefaultSerializationServiceBuilder().build();
key = serializationService.toData("key");
value = invalidData;
logger = mock(ILogger.class);
request = MapGetCodec.encodeRequest("test", key, 1L);
response = MapGetCodec.encodeResponse(value);
callIdSequence = mock(CallIdSequence.class);
invocationFuture = new ClientInvocationFuture(mock(ClientInvocation.class), request, logger, callIdSequence);
invocationFuture.complete(response);
delegatingFuture = new ClientDelegatingFuture<>(invocationFuture, serializationService, MapGetCodec::decodeResponse, true);
}
use of com.hazelcast.internal.serialization.impl.DefaultSerializationServiceBuilder in project hazelcast by hazelcast.
the class PortableTest method test_issue2172_WritePortableArray.
//https://github.com/hazelcast/hazelcast/issues/2172
@Test
public void test_issue2172_WritePortableArray() {
final SerializationService ss = new DefaultSerializationServiceBuilder().setInitialOutputBufferSize(16).build();
final TestObject2[] testObject2s = new TestObject2[100];
for (int i = 0; i < testObject2s.length; i++) {
testObject2s[i] = new TestObject2();
}
final TestObject1 testObject1 = new TestObject1(testObject2s);
ss.toData(testObject1);
}
use of com.hazelcast.internal.serialization.impl.DefaultSerializationServiceBuilder in project hazelcast by hazelcast.
the class PortableTest method testClassDefinition_getNestedField.
@Test
public void testClassDefinition_getNestedField() throws IOException {
InternalSerializationService serializationService = new DefaultSerializationServiceBuilder().build();
PortableContext portableContext = serializationService.getPortableContext();
ChildPortableObject child = new ChildPortableObject(System.nanoTime());
ParentPortableObject parent = new ParentPortableObject(System.currentTimeMillis(), child);
GrandParentPortableObject grandParent = new GrandParentPortableObject(System.nanoTime(), parent);
Data data = serializationService.toData(grandParent);
ClassDefinition classDefinition = portableContext.lookupClassDefinition(data);
FieldDefinition fd = portableContext.getFieldDefinition(classDefinition, "child");
assertNotNull(fd);
assertEquals(FieldType.PORTABLE, fd.getType());
fd = portableContext.getFieldDefinition(classDefinition, "child.child");
assertNotNull(fd);
assertEquals(FieldType.PORTABLE, fd.getType());
fd = portableContext.getFieldDefinition(classDefinition, "child.child.timestamp");
assertNotNull(fd);
assertEquals(FieldType.LONG, fd.getType());
}
Aggregations