use of org.apache.ignite.internal.binary.BinaryMarshaller in project ignite by apache.
the class GridSessionCheckpointSelfTest method testCacheCheckpoint.
/**
* @throws Exception If failed.
*/
public void testCacheCheckpoint() throws Exception {
IgniteConfiguration cfg = getConfiguration();
String cacheName = "test-checkpoints";
CacheConfiguration cacheCfg = defaultCacheConfiguration();
cacheCfg.setName(cacheName);
CacheCheckpointSpi spi = new CacheCheckpointSpi();
spi.setCacheName(cacheName);
cfg.setCacheConfiguration(cacheCfg);
cfg.setCheckpointSpi(spi);
if (cfg.getMarshaller() instanceof BinaryMarshaller) {
BinaryContext ctx = new BinaryContext(BinaryCachingMetadataHandler.create(), cfg, new NullLogger());
Marshaller marsh = cfg.getMarshaller();
marsh.setContext(new MarshallerContextTestImpl(null));
IgniteUtils.invoke(BinaryMarshaller.class, marsh, "setBinaryContext", ctx, cfg);
}
GridSessionCheckpointSelfTest.spi = spi;
checkCheckpoints(cfg);
}
use of org.apache.ignite.internal.binary.BinaryMarshaller in project ignite by apache.
the class CacheEntryProcessorCopySelfTest method doTestMutableEntry.
/**
*
*/
private void doTestMutableEntry(boolean p2pEnabled) throws Exception {
this.p2pEnabled = p2pEnabled;
Ignite grid = startGrid();
assertEquals(p2pEnabled, grid.configuration().isPeerClassLoadingEnabled());
try {
// One deserialization due to copyOnRead == true.
doTest(true, false, OLD_VAL, 1);
// One deserialization due to copyOnRead == true.
// Additional deserialization in case p2p enabled and not BinaryMarshaller due to storeValue == true on update entry.
doTest(true, true, NEW_VAL, p2pEnabled && !(grid.configuration().getMarshaller() instanceof BinaryMarshaller) ? 2 : 1);
// No deserialization.
doTest(false, false, NEW_VAL, 0);
// One deserialization due to storeValue == true.
doTest(false, true, NEW_VAL, 1);
} finally {
stopAllGrids();
}
}
use of org.apache.ignite.internal.binary.BinaryMarshaller in project ignite by apache.
the class GridMarshallerPerformanceTest method testGridMarshaller.
/**
* @throws Exception If failed.
*/
public void testGridMarshaller() throws Exception {
final GridTuple<byte[]> tuple = new GridTuple<>();
final BinaryMarshaller marsh = createStandaloneBinaryMarshaller();
IgniteInClosure<TestObject> writer = new CIX1<TestObject>() {
@Override
public void applyx(TestObject obj) throws IgniteCheckedException {
tuple.set(marsh.marshal(obj));
}
};
IgniteOutClosure<TestObject> reader = new COX<TestObject>() {
@Override
public TestObject applyx() throws IgniteCheckedException {
return marsh.unmarshal(tuple.get(), null);
}
};
runTest("GridMarshaller", writer, reader);
}
use of org.apache.ignite.internal.binary.BinaryMarshaller in project ignite by apache.
the class ClientReconnectAfterClusterRestartTest method getConfiguration.
/** {@inheritDoc} */
@Override
protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
cfg.setMarshaller(new BinaryMarshaller());
cfg.setIncludeEventTypes(EventType.EVTS_CACHE);
if (getTestIgniteInstanceName(CLIENT_ID).equals(igniteInstanceName))
cfg.setClientMode(true);
else {
CacheConfiguration ccfg = getCacheConfiguration();
cfg.setCacheConfiguration(ccfg);
}
return cfg;
}
use of org.apache.ignite.internal.binary.BinaryMarshaller in project ignite by apache.
the class QueryEntityCaseMismatchTest method getConfiguration.
/** {@inheritDoc} */
@Override
protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(gridName);
cfg.setLocalHost("127.0.0.1");
cfg.setPeerClassLoadingEnabled(true);
TcpDiscoveryVmIpFinder ipFinder = new TcpDiscoveryVmIpFinder(true);
ipFinder.setAddresses(Collections.singletonList("127.0.0.1:47500..47509"));
TcpDiscoverySpi discoSpi = new TcpDiscoverySpi();
discoSpi.setIpFinder(ipFinder);
cfg.setDiscoverySpi(discoSpi);
CacheConfiguration<Object, Integer> ccfg = new CacheConfiguration<>(DEFAULT_CACHE_NAME);
cfg.setMarshaller(new BinaryMarshaller());
QueryEntity queryEntity = new QueryEntity("KeyType", Integer.class.getName());
LinkedHashMap<String, String> fields = new LinkedHashMap<>();
fields.put("a", "TypeA");
fields.put("b", "TypeB");
queryEntity.setFields(fields);
//Specify key fields in upper register
HashSet<String> keyFields = new HashSet<>();
keyFields.add("a");
keyFields.add("B");
queryEntity.setKeyFields(keyFields);
ccfg.setQueryEntities(F.asList(queryEntity));
cfg.setCacheConfiguration(ccfg);
return cfg;
}
Aggregations