예제 #1
0
  /** Tests the {@link org.jruby.runtime.profile.ProfilingServiceLookup} too */
  public void testNoProfilingServerAvailableIfProfilingIsDisabled() {
    RubyInstanceConfig config = Ruby.getGlobalRuntime().getInstanceConfig();

    RubyInstanceConfig configOne = new RubyInstanceConfig(config);
    configOne.setProfilingMode(RubyInstanceConfig.ProfilingMode.OFF);

    Ruby ruby = Ruby.newInstance(configOne);

    assertNull(ruby.getProfilingService());
  }
예제 #2
0
  /** Tests the {@link org.jruby.runtime.profile.ProfilingServiceLookup} too */
  public void testProfilingServiceLookupWorks() {
    try {
      RubyInstanceConfig config = Ruby.getGlobalRuntime().getInstanceConfig();

      RubyInstanceConfig configOne = new RubyInstanceConfig(config);

      configOne.setProfilingService(TestProfilingService.class.getName());
      configOne.setProfilingMode(RubyInstanceConfig.ProfilingMode.SERVICE);
      Ruby ruby = Ruby.newInstance(configOne);

      assertNotNull(ruby.getProfilingService());
      assertTrue(ruby.getProfilingService() instanceof TestProfilingService);
    } catch (RaiseException e) {
      // e.printStackTrace();
      // TODO hwo to mock org.jruby.exceptions.RaiseException: (LoadError) no such file to load --
      // jruby/profiler/shutdown_hook
    }
  }