use of org.apache.ignite.marshaller.Marshaller in project ignite by apache.
the class GridTopicExternalizableSelfTest method testSerializationTopicCreatedByGridUuidAndLong.
/**
* @throws Exception If failed.
*/
public void testSerializationTopicCreatedByGridUuidAndLong() 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, A_LONG);
assertEquals(msgOut, GridTestIoUtils.externalize(msgOut, marsh));
}
}
}
use of org.apache.ignite.marshaller.Marshaller in project ignite by apache.
the class GridTopicExternalizableSelfTest method testSerializationTopicCreatedByStringAndUUIDAndIntAndLong.
/**
* @throws Exception If failed.
*/
public void testSerializationTopicCreatedByStringAndUUIDAndIntAndLong() 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, AN_INT, A_LONG);
assertEquals(msgOut, GridTestIoUtils.externalize(msgOut, marsh));
}
}
}
use of org.apache.ignite.marshaller.Marshaller in project ignite by apache.
the class CacheEnumOperationsAbstractTest method assertBinaryEnum.
/**
* @param cache Cache.
* @param key Key.
* @param expVal Expected value.
*/
private static void assertBinaryEnum(IgniteCache<Object, Object> cache, int key, TestEnum expVal) {
Marshaller marsh = ((IgniteCacheProxy) cache).context().marshaller();
if (marsh instanceof BinaryMarshaller) {
BinaryObject enumObj = (BinaryObject) cache.withKeepBinary().get(key);
assertEquals(expVal.ordinal(), enumObj.enumOrdinal());
assertTrue(enumObj.type().isEnum());
assertTrue(enumObj instanceof BinaryEnumObjectImpl);
}
}
use of org.apache.ignite.marshaller.Marshaller in project ignite by apache.
the class OptimizedMarshallerNodeFailoverTest method testRestartAllNodes.
/**
* @throws Exception If failed.
*/
public void testRestartAllNodes() throws Exception {
cache = true;
String home = U.getIgniteHome();
String[] workDirs = new String[3];
for (int i = 0; i < 3; i++) {
workDirs[i] = home + "/work/marshallerTestNode_" + i;
File file = new File(workDirs[i]);
if (file.exists())
assert U.delete(file);
}
try {
for (int i = 0; i < workDirs.length; i++) {
workDir = workDirs[i];
startGrid(i);
}
Marshaller marsh = ignite(0).configuration().getMarshaller();
TestClass1 obj = new TestClass1();
obj.val = 111;
byte[] bytes = marsh.marshal(obj);
stopAllGrids();
for (int i = 0; i < workDirs.length; i++) {
workDir = workDirs[i];
startGrid(i);
}
for (int i = 0; i < 3; i++) {
marsh = ignite(i).configuration().getMarshaller();
TestClass1 obj0 = marsh.unmarshal(bytes, null);
assertEquals(111, obj0.val);
}
} finally {
for (String dir : workDirs) assert U.delete(new File(dir));
}
}
use of org.apache.ignite.marshaller.Marshaller in project ignite by apache.
the class OptimizedMarshallerTest method testSerializableAfterChangingValue.
/**
* @throws IgniteCheckedException If failed.
*/
public void testSerializableAfterChangingValue() throws IgniteCheckedException {
Marshaller marsh = marshaller();
SomeSimpleSerializable newObj = new SomeSimpleSerializable();
assert (newObj.flag);
newObj.setFlagValue(false);
assert (!newObj.flag);
SomeSimpleSerializable outObj = marsh.unmarshal(marsh.marshal(newObj), null);
assert (!outObj.flag);
}
Aggregations