Search in sources :

Example 11 with Marshaller

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));
        }
    }
}
Also used : Marshaller(org.apache.ignite.marshaller.Marshaller) Externalizable(java.io.Externalizable)

Example 12 with Marshaller

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));
        }
    }
}
Also used : Marshaller(org.apache.ignite.marshaller.Marshaller) Externalizable(java.io.Externalizable)

Example 13 with Marshaller

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));
        }
    }
}
Also used : Marshaller(org.apache.ignite.marshaller.Marshaller) Externalizable(java.io.Externalizable)

Example 14 with Marshaller

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()));
    }
}
Also used : ClusterNode(org.apache.ignite.cluster.ClusterNode) Marshaller(org.apache.ignite.marshaller.Marshaller) ClusterGroup(org.apache.ignite.cluster.ClusterGroup) Ignite(org.apache.ignite.Ignite)

Example 15 with Marshaller

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());
}
Also used : Marshaller(org.apache.ignite.marshaller.Marshaller)

Aggregations

Marshaller (org.apache.ignite.marshaller.Marshaller)46 Externalizable (java.io.Externalizable)8 BinaryMarshaller (org.apache.ignite.internal.binary.BinaryMarshaller)8 IgniteCheckedException (org.apache.ignite.IgniteCheckedException)6 HttpURLConnection (java.net.HttpURLConnection)5 URL (java.net.URL)5 URLConnection (java.net.URLConnection)5 ArrayList (java.util.ArrayList)5 HttpSession (javax.servlet.http.HttpSession)5 IgniteException (org.apache.ignite.IgniteException)5 JdkMarshaller (org.apache.ignite.marshaller.jdk.JdkMarshaller)5 Ignite (org.apache.ignite.Ignite)4 IgniteConfiguration (org.apache.ignite.configuration.IgniteConfiguration)4 Server (org.eclipse.jetty.server.Server)4 File (java.io.File)2 OutputStream (java.io.OutputStream)2 BinaryConfiguration (org.apache.ignite.configuration.BinaryConfiguration)2 IgniteClientDisconnectedCheckedException (org.apache.ignite.internal.IgniteClientDisconnectedCheckedException)2 BinaryContext (org.apache.ignite.internal.binary.BinaryContext)2 ClusterTopologyCheckedException (org.apache.ignite.internal.cluster.ClusterTopologyCheckedException)2