Package com.p6spy.engine.spy

Examples of com.p6spy.engine.spy.P6SpyLoadableOptions


  public SpyDotPropertiesReloader(SpyDotProperties spyDotProperties,
                                  P6ModuleManager p6ModuleManager) {
    this.spyDotProperties = spyDotProperties;
   
    final P6SpyLoadableOptions spyOptions = p6ModuleManager.getOptions(P6SpyOptions.class);
    reschedule(spyOptions.getReloadProperties(), spyOptions.getReloadPropertiesInterval());
   
    p6ModuleManager.registerOptionChangedListener(this);
  }
View Full Code Here


    Assert.assertTrue(expectedSet.isEmpty());
  }
 
  @Test
  public void testP6SpyOptionDefaults() {
    P6SpyLoadableOptions opts = P6SpyOptions.getActiveInstance();
    Assert.assertNotNull(opts);

    Assert.assertEquals(SingleLineFormat.class.getName(), opts.getLogMessageFormat());
    Assert.assertEquals("spy.log", opts.getLogfile());
    Assert.assertTrue(opts.getAppend());
    Assert.assertNull(opts.getDateformat());
    Assert.assertEquals(FileLogger.class.getName(), opts.getAppender());
    Assert.assertEquals(P6SpyFactory.class.getName() + ","+ P6LogFactory.class.getName(), opts.getModulelist());
    Assert.assertEquals(2, opts.getModuleFactories().size());
    assertP6FactoryClassesEqual(DEFAULT_FACTORIES, opts.getModuleFactories());
    Assert.assertEquals(2, opts.getModuleNames().size());
    Assert.assertTrue(opts.getModuleNames().contains(P6SpyFactory.class.getName()));
    Assert.assertTrue(opts.getModuleNames().contains(P6LogFactory.class.getName()));
    Assert.assertEquals("", opts.getDriverlist());
    Assert.assertNull(opts.getDriverNames());
    Assert.assertFalse(opts.getStackTrace());
    Assert.assertNull(opts.getStackTraceClass());
    Assert.assertFalse(opts.getAutoflush());
    Assert.assertFalse(opts.getReloadProperties());
    Assert.assertEquals(60L, opts.getReloadPropertiesInterval());
    Assert.assertNull(opts.getJNDIContextFactory());
    Assert.assertNull(opts.getJNDIContextProviderURL());
    Assert.assertNull(opts.getJNDIContextCustom());
    Assert.assertNull(opts.getRealDataSource());
    Assert.assertNull(opts.getRealDataSourceClass());
    Assert.assertEquals("dd-MMM-yy", opts.getDatabaseDialectDateFormat());
    Assert.assertTrue(opts.getJmx());
    Assert.assertNull(opts.getJmxPrefix());
  }
View Full Code Here

    };
  }
 
  @Test
  public void testUnSetSpyAPI() {
    final P6SpyLoadableOptions opts = P6SpyOptions.getActiveInstance();
   
    opts.setJNDIContextCustom("foo");
    Assert.assertEquals("foo", opts.getJNDIContextCustom());
    opts.unSetJNDIContextCustom();
    Assert.assertNull(opts.getJNDIContextCustom());
   
    opts.setJNDIContextFactory("fooFactory");
    Assert.assertEquals("fooFactory", opts.getJNDIContextFactory());
    opts.unSetJNDIContextFactory();
    Assert.assertNull(opts.getJNDIContextFactory());
   
    opts.setJNDIContextProviderURL("http://fooUrl");
    Assert.assertEquals("http://fooUrl", opts.getJNDIContextProviderURL());
    opts.unSetJNDIContextProviderURL();
    Assert.assertNull(opts.getJNDIContextProviderURL());
   
    opts.setRealDataSource("fooDS");
    Assert.assertEquals("fooDS", opts.getRealDataSource());
    opts.unSetRealDataSource();
    Assert.assertNull(opts.getRealDataSource());
   
    opts.setRealDataSourceClass("fooDSClass");
    Assert.assertEquals("fooDSClass", opts.getRealDataSourceClass());
    opts.unSetRealDataSourceClass();
    Assert.assertNull(opts.getRealDataSourceClass());
   
    opts.setRealDataSourceProperties("fooDSProps");
    Assert.assertEquals("fooDSProps", opts.getRealDataSourceProperties());
    opts.unSetRealDataSourceProperties();
    Assert.assertNull(opts.getRealDataSourceProperties());
  }
View Full Code Here

  public ConnectionMonitor(Configuration configuration, MetricRegistry metricRegistry) {
    this.metricRegistry = metricRegistry;

    if (ACTIVE && configuration.getConfig(JdbcPlugin.class).isCollectSql()) {
      unregisterP6SpyMBeans();
      P6SpyLoadableOptions options = P6SpyOptions.getActiveInstance();
      addStagemonitorLogger(configuration, options);
      p6SpyAlreadyConfigured = options.getDriverNames() == null || options.getDriverNames().isEmpty();
      if (!p6SpyAlreadyConfigured) {
        logger.info("Stagemonitor will not wrap connections with p6spy wrappers, because p6spy is already " +
            "configured in your application");
      }
      P6Core.initialize();
View Full Code Here

TOP

Related Classes of com.p6spy.engine.spy.P6SpyLoadableOptions

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.