/** */ @Override protected void beforeTest() throws Exception { super.beforeTest(); strLog = new GridStringLogger(false, log); strLog.logLength(1024 * 1024); }
/** * @throws Exception If fail. */ @Test public void testNoExceptionOnServerNode() throws Exception { ldr = new URLClassLoader(URLS, getClass().getClassLoader()); clientMode = false; setExternalLoader = true; final Ignite ignite0 = startGrid(1); executeContinuousQuery(ignite0.cache("simple")); log = new GridStringLogger(); startGrid(2); assertTrue(!log.toString().contains("class org.apache.ignite.IgniteCheckedException: " + "Failed to find class with given class loader for unmarshalling")); }
/** Check that dev-only messages appear in the log. */ @Test public void testDevOnlyVerboseMessage() throws Exception { additionalArgs = Collections.singletonList("-D" + IgniteSystemProperties.IGNITE_QUIET + "=false"); log = new GridStringLogger(false, grid(0).log()); Ignite ignite = startGrid(1); String msg = getMessage(ignite); warnDevOnly(msg); assertTrue(log.toString().contains(msg)); }
/** * @throws Exception If failed. */ @Test public void testJulMessage() throws Exception { this.strLog = new GridStringLogger(true); strLog.logLength(300000); startGrid(0); assertTrue(strLog.toString().contains("LongJVMPauseDetector was successfully started")); }
/** * @throws Exception If fail. */ @Test public void testNoWarningMessageOnClientNode() throws Exception { ldr = new URLClassLoader(URLS, getClass().getClassLoader()); setExternalLoader = true; clientMode = false; final Ignite ignite0 = startGrid(1); executeContinuousQuery(ignite0.cache("simple")); log = new GridStringLogger(); clientMode = true; startGrid(2); assertTrue(!log.toString().contains("Failed to unmarshal continuous query remote filter on client node. " + "Can be ignored.")); }
/** * @throws Exception If fail. */ @Test public void testWarningMessageOnClientNode() throws Exception { ldr = new URLClassLoader(URLS, getClass().getClassLoader()); clientMode = false; setExternalLoader = true; final Ignite ignite0 = startGrid(1); executeContinuousQuery(ignite0.cache("simple")); log = new GridStringLogger(); clientMode = true; setExternalLoader = false; startGrid(2); String logStr = log.toString(); assertTrue(logStr.contains("Failed to unmarshal continuous query remote filter on client node. " + "Can be ignored.") || logStr.contains("Failed to unmarshal continuous routine handler")); }
/** * @throws Exception If fail. */ @Test public void testExceptionOnServerNode() throws Exception { ldr = new URLClassLoader(URLS, getClass().getClassLoader()); clientMode = false; setExternalLoader = true; final Ignite ignite0 = startGrid(1); executeContinuousQuery(ignite0.cache("simple")); log = new GridStringLogger(); setExternalLoader = false; startGrid(2); String logStr = log.toString(); assertTrue(logStr.contains("class org.apache.ignite.IgniteCheckedException: " + "Failed to find class with given class loader for unmarshalling") || logStr.contains("Failed to unmarshal continuous routine handler")); }
/** Check that dev-only messages appear in the log. */ @Ignore("https://issues.apache.org/jira/browse/IGNITE-9328") @Test public void testDevOnlyQuietMessage() throws Exception { additionalArgs = Collections.singletonList("-D" + IgniteSystemProperties.IGNITE_QUIET + "=true"); log = new GridStringLogger(false, grid(0).log()); Ignite ignite = startGrid(1); String msg = getMessage(ignite); warnDevOnly(msg); assertTrue(log.toString().contains(msg)); }
/** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName); if (srvcCfg != null) cfg.setServiceConfiguration(srvcCfg); if (useStrLog) { GridStringLogger strLog = new GridStringLogger(false, cfg.getGridLogger()); strLog.logLength(100 * 1024); cfg.setGridLogger(strLog); strLoggers.add(strLog); } return cfg; }
/** */ private IgniteEx startGridWithLogCapture() throws Exception { IgniteEx ignite = startGrid(0); this.capture = new GridStringLogger(false, this.log); GridTestUtils.setFieldValue(ignite.context().query(), GridProcessorAdapter.class,"log", capture); return ignite; }
/** * Check that {@link IgniteUtils#warnDevOnly(IgniteLogger, Object)} * doesn't print anything if {@link org.apache.ignite.IgniteSystemProperties#IGNITE_DEV_ONLY_LOGGING_DISABLED} * is set to {@code true}. */ @Test public void testDevOnlyDisabledProperty() throws Exception { additionalArgs = Collections.singletonList("-D" + IgniteSystemProperties.IGNITE_DEV_ONLY_LOGGING_DISABLED + "=true"); log = new GridStringLogger(false, grid(0).log()); Ignite ignite = startGrid(1); String msg = getMessage(ignite); warnDevOnly(msg); assertFalse(log.toString().contains(msg)); }
/** * @throws Exception If failed. */ @Test public void testSemaphoreClosing() throws Exception { IgniteConfiguration cfg; GridStringLogger stringLogger; stringLogger = new GridStringLogger(); cfg = optimize(getConfiguration("npeGrid")); cfg.setGridLogger(stringLogger); try (Ignite ignite = startGrid(cfg.getIgniteInstanceName(), cfg)) { ignite.semaphore("semaphore", 1, true, true); } assertFalse(stringLogger.toString().contains(NullPointerException.class.getName())); }
/** {@inheritDoc} */ @SuppressWarnings("deprecation") @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName); cfg.setCacheConfiguration(cacheConfiguration(DEFAULT_CACHE_NAME)); cfg.setMarshaller(new BinaryMarshaller()); cfg.setGridLogger(new GridStringLogger()); return cfg; }
/** * Test that node matched by filter and having filter instantiation problems fails for sure. * * @throws Exception if failed. */ @Test public void testNodeWithAttributeFailure() throws Exception { try (Ignite node1 = startNodeWithCache()) { GridStringLogger log = new GridStringLogger(); try (Ignite node2 = startGrid("node2", getConfiguration("node2", true, log))) { fail(); } catch (IgniteException ignored) { assertTrue(log.toString().contains("Class not found for continuous query remote filter " + "[name=org.apache.ignite.tests.p2p.CacheDeploymentEntryEventFilter]")); } } }
/** {@inheritDoc} */ @SuppressWarnings({"deprecation", "unchecked"}) @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName); cfg.setCacheConfiguration(cacheConfiguration(DEFAULT_CACHE_NAME).setNearConfiguration(null)); cfg.setMarshaller(new BinaryMarshaller()); cfg.setGridLogger(log = new GridStringLogger()); return cfg; }
/** {@inheritDoc} */ @SuppressWarnings({"deprecation", "unchecked"}) @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName); cfg.setCacheConfiguration(cacheConfiguration(DEFAULT_CACHE_NAME).setNearConfiguration(null)); cfg.setMarshaller(new BinaryMarshaller()); cfg.setGridLogger(new GridStringLogger()); return cfg; }
/** {@inheritDoc} */ @SuppressWarnings({"deprecation", "unchecked"}) @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName); cfg.setCacheConfiguration(cacheConfiguration(DEFAULT_CACHE_NAME).setNearConfiguration(null)); cfg.setMarshaller(new BinaryMarshaller()); cfg.setGridLogger(log = new GridStringLogger()); return cfg; }
/** * */ @Test public void testEnabledManager() throws IgniteCheckedException { GridTestKernalContext ctx = new GridTestKernalContext(new GridStringLogger()); assertTrue(new Manager(ctx, new Spi()).enabled()); assertFalse(new Manager(ctx, new NoopSpi()).enabled()); assertTrue(new Manager(ctx, new Spi(), new NoopSpi()).enabled()); assertTrue(new Manager(ctx, new NoopSpi(), new Spi()).enabled()); }
/** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName); if (useStrLog) { strLog = new GridStringLogger(false, cfg.getGridLogger()); cfg.setGridLogger(strLog); } cfg.setDeploymentMode(depMode); if (cacheEnabled) { CacheConfiguration cacheCfg = defaultCacheConfiguration(); cacheCfg.setName(cacheName); cacheCfg.setCacheMode(cacheMode); cacheCfg.setAffinity(aff); cacheCfg.setBackups(backups); cacheCfg.setAtomicityMode(TRANSACTIONAL); if (initCache != null) initCache.apply(cacheCfg); cfg.setCacheConfiguration(cacheCfg); } else cfg.setCacheConfiguration(); return cfg; }
/** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName); cfg.setDataStorageConfiguration( new DataStorageConfiguration() .setFileIOFactory(new SlowCheckpointFileIOFactory()) .setCheckpointThreads(checkpointThreads) .setDefaultDataRegionConfiguration( new DataRegionConfiguration() .setPersistenceEnabled(true) .setMaxSize(MAX_SIZE) .setCheckpointPageBufferSize(CP_BUF_SIZE) ) ); cfg.setFailureHandler(new StopNodeFailureHandler()); strLog = new GridStringLogger(false, new GridTestLog4jLogger()); cfg.setGridLogger(strLog); return cfg; }