use of org.apache.ignite.marshaller.Marshaller in project ignite by apache.
the class GridTopicExternalizableSelfTest method testSerializationTopicCreatedByStringAndUUIDAndLong.
/**
* @throws Exception If failed.
*/
public void testSerializationTopicCreatedByStringAndUUIDAndLong() throws Exception {
for (Marshaller marsh : getMarshallers()) {
info("Test GridTopic externalization [marshaller=" + marsh + ']');
for (GridTopic topic : GridTopic.values()) {
Externalizable msgOut = (Externalizable) topic.topic(A_STRING, AN_UUID, A_LONG);
assertEquals(msgOut, GridTestIoUtils.externalize(msgOut, marsh));
}
}
}
use of org.apache.ignite.marshaller.Marshaller in project ignite by apache.
the class GridTopicExternalizableSelfTest method testSerializationTopicCreatedByStrinAndLong.
/**
* @throws Exception If failed.
*/
public void testSerializationTopicCreatedByStrinAndLong() throws Exception {
for (Marshaller marsh : getMarshallers()) {
info("Test GridTopic externalization [marshaller=" + marsh + ']');
for (GridTopic topic : GridTopic.values()) {
Externalizable msgOut = (Externalizable) topic.topic(A_STRING, A_LONG);
assertEquals(msgOut, GridTestIoUtils.externalize(msgOut, marsh));
}
}
}
use of org.apache.ignite.marshaller.Marshaller in project ignite by apache.
the class GridTopicExternalizableSelfTest method testSerializationTopicCreatedByGridUuidAndUUID.
/**
* @throws Exception If failed.
*/
public void testSerializationTopicCreatedByGridUuidAndUUID() throws Exception {
for (Marshaller marsh : getMarshallers()) {
info("Test GridTopic externalization [marshaller=" + marsh + ']');
for (GridTopic topic : GridTopic.values()) {
Externalizable msgOut = (Externalizable) topic.topic(A_GRID_UUID, AN_UUID);
assertEquals(msgOut, GridTestIoUtils.externalize(msgOut, marsh));
}
}
}
use of org.apache.ignite.marshaller.Marshaller in project ignite by apache.
the class ClusterGroupSelfTest method testAgeClusterGroupSerialization.
/**
* @throws Exception If failed.
*/
public void testAgeClusterGroupSerialization() throws Exception {
Marshaller marshaller = ignite.configuration().getMarshaller();
ClusterGroup grp = ignite.cluster().forYoungest();
ClusterNode node = grp.node();
byte[] arr = marshaller.marshal(grp);
ClusterGroup obj = marshaller.unmarshal(arr, null);
assertEquals(node.id(), obj.node().id());
try (Ignite ignore = startGrid()) {
obj = marshaller.unmarshal(arr, null);
assertEquals(grp.node().id(), obj.node().id());
assertFalse(node.id().equals(obj.node().id()));
}
}
use of org.apache.ignite.marshaller.Marshaller in project ignite by apache.
the class BinaryEnumsSelfTest method checkInstanceFromBytes.
/**
* @param binCtx Binary context.
* @param ord Enum ordinal.
* @param typeId Type Id.
* @param clsName Class name.
*/
private void checkInstanceFromBytes(BinaryContext binCtx, int ord, int typeId, String clsName) throws IgniteCheckedException {
BinaryEnumObjectImpl srcBinEnum = new BinaryEnumObjectImpl(binCtx, typeId, clsName, ord);
Marshaller marsh = node1.configuration().getMarshaller();
byte[] bytes = marsh.marshal(srcBinEnum);
BinaryEnumObjectImpl binEnum = new BinaryEnumObjectImpl(binCtx, bytes);
assertEquals(clsName, binEnum.className());
assertEquals(typeId, binEnum.typeId());
assertEquals(ord, binEnum.enumOrdinal());
}
Aggregations