use of org.apache.ignite.logger.NullLogger in project ignite by apache.
the class BinaryFooterOffsetsAbstractSelfTest method beforeTest.
/**
* {@inheritDoc}
*/
@Override
protected void beforeTest() throws Exception {
super.beforeTest();
ctx = new BinaryContext(BinaryCachingMetadataHandler.create(), new IgniteConfiguration(), new NullLogger());
marsh = new BinaryMarshaller();
IgniteConfiguration iCfg = new IgniteConfiguration();
BinaryConfiguration bCfg = new BinaryConfiguration();
bCfg.setTypeConfigurations(Arrays.asList(new BinaryTypeConfiguration(TestObject.class.getName())));
bCfg.setCompactFooter(compactFooter());
iCfg.setBinaryConfiguration(bCfg);
marsh.setContext(new MarshallerContextTestImpl(null));
marsh.setBinaryContext(ctx, iCfg);
}
use of org.apache.ignite.logger.NullLogger in project ignite by apache.
the class GridBinaryWildcardsSelfTest method binaryMarshaller.
/**
*/
protected BinaryMarshaller binaryMarshaller(BinaryNameMapper nameMapper, BinaryIdMapper mapper, BinarySerializer serializer, Collection<BinaryTypeConfiguration> cfgs) throws IgniteCheckedException {
IgniteConfiguration iCfg = new IgniteConfiguration();
BinaryConfiguration bCfg = new BinaryConfiguration();
bCfg.setNameMapper(nameMapper);
bCfg.setIdMapper(mapper);
bCfg.setSerializer(serializer);
bCfg.setTypeConfigurations(cfgs);
iCfg.setBinaryConfiguration(bCfg);
BinaryContext ctx = new BinaryContext(BinaryNoopMetadataHandler.instance(), iCfg, new NullLogger());
BinaryMarshaller marsh = new BinaryMarshaller();
marsh.setContext(new MarshallerContextTestImpl(null));
marsh.setBinaryContext(ctx, iCfg);
return marsh;
}
use of org.apache.ignite.logger.NullLogger in project ignite by apache.
the class GridBinaryCacheEntryMemorySizeSelfTest method createMarshaller.
/**
* {@inheritDoc}
*/
@Override
protected Marshaller createMarshaller() throws IgniteCheckedException {
BinaryMarshaller marsh = new BinaryMarshaller();
IgniteConfiguration iCfg = new IgniteConfiguration();
iCfg.setDiscoverySpi(new TcpDiscoverySpi() {
@Override
public void sendCustomEvent(DiscoverySpiCustomMessage msg) throws IgniteException {
// No-op.
}
});
iCfg.setClientMode(false);
iCfg.setSystemViewExporterSpi(new JmxSystemViewExporterSpi() {
@Override
protected void register(SystemView<?> sysView) {
// No-op.
}
});
GridTestKernalContext kernCtx = new GridTestKernalContext(log, iCfg);
kernCtx.add(new GridSystemViewManager(kernCtx));
kernCtx.add(new GridDiscoveryManager(kernCtx));
MarshallerContextTestImpl marshCtx = new MarshallerContextTestImpl(null);
marshCtx.onMarshallerProcessorStarted(kernCtx, null);
marsh.setContext(marshCtx);
BinaryContext pCtx = new BinaryContext(BinaryNoopMetadataHandler.instance(), iCfg, new NullLogger());
marsh.setBinaryContext(pCtx, iCfg);
return marsh;
}
use of org.apache.ignite.logger.NullLogger in project ignite by apache.
the class GridSessionCheckpointSelfTest method testCacheCheckpoint.
/**
* @throws Exception If failed.
*/
@Test
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) {
BinaryMarshaller marsh = (BinaryMarshaller) cfg.getMarshaller();
BinaryContext ctx = new BinaryContext(BinaryCachingMetadataHandler.create(), cfg, new NullLogger());
marsh.setContext(new MarshallerContextTestImpl(null));
marsh.setBinaryContext(ctx, cfg);
}
GridSessionCheckpointSelfTest.spi = spi;
checkCheckpoints(cfg);
}
use of org.apache.ignite.logger.NullLogger in project ignite by apache.
the class GridTcpCommunicationSpiConfigSelfTest method testSendToNonInitializedTcpCommSpi.
/**
* Verifies that TcpCommunicationSpi starts messaging protocol only when fully initialized.
*
* @see <a href="https://issues.apache.org/jira/browse/IGNITE-12982">IGNITE-12982</a>
*
* @throws Exception If failed.
*/
@Test
@WithSystemProperty(key = "IGNITE_SKIP_CONFIGURATION_CONSISTENCY_CHECK", value = "true")
public void testSendToNonInitializedTcpCommSpi() throws Exception {
ListeningTestLogger listeningLogger = new ListeningTestLogger(log);
LogListener npeLsnr = LogListener.matches("NullPointerException").andMatches("InboundConnectionHandler.onMessageSent").build();
listeningLogger.registerListener(npeLsnr);
GridTestNode sendingNode = new GridTestNode();
sendingNode.order(0);
GridSpiTestContext sendingCtx = initSpiContext();
TcpCommunicationSpi sendingSpi = initializeSpi(sendingCtx, sendingNode, listeningLogger, false);
spisToStop.add(sendingSpi);
sendingSpi.onContextInitialized(sendingCtx);
GridTestNode receiverNode = new GridTestNode();
receiverNode.order(1);
GridSpiTestContext receiverCtx = initSpiContext();
/*
* This is a dirty hack to intervene into TcpCommunicationSpi#onContextInitialized0 method
* and add a delay before injecting metrics listener into its clients (like InboundConnectionHandler).
* The purpose of the delay is to make race between sending a message and initializing TcpCommSpi visible.
*
* This solution heavily depends on current code structure of onContextInitialized0 method.
* If any modifications are made to it, this logic could break and the test starts failing.
*
* In that case try to rewrite the test or delete it as this race is really hard to test.
*/
receiverCtx.metricsRegistryProducer((name) -> {
try {
Thread.sleep(100);
} catch (Exception ignored) {
// No-op.
}
return new MetricRegistry(name, null, null, new NullLogger());
});
TcpCommunicationSpi receiverSpi = initializeSpi(receiverCtx, receiverNode, listeningLogger, true);
spisToStop.add(receiverSpi);
receiverCtx.remoteNodes().add(sendingNode);
sendingCtx.remoteNodes().add(receiverNode);
IgniteInternalFuture sendFut = GridTestUtils.runAsync(() -> {
Message msg = new GridTestMessage(sendingNode.id(), 0, 0);
sendingSpi.sendMessage(receiverNode, msg);
});
IgniteInternalFuture initFut = GridTestUtils.runAsync(() -> {
try {
receiverSpi.onContextInitialized(receiverCtx);
} catch (Exception ignored) {
// No-op.
}
});
assertFalse("Check test logs, NPE was found", GridTestUtils.waitForCondition(npeLsnr::check, 3_000));
initFut.get();
sendFut.get();
}
Aggregations