Examples of FileCache


Examples of org.glassfish.grizzly.http.server.filecache.FileCache

            builder.add(new IdleTimeoutFilter(delayedExecutor,
                    listener.getKeepAlive().getIdleTimeoutInSeconds(),
                    TimeUnit.SECONDS));
           
            final Transport transport = listener.getTransport();
            final FileCache fileCache = listener.getFileCache();
            fileCache.initialize(delayedExecutor);
            final FileCacheFilter fileCacheFilter = new FileCacheFilter(fileCache);
            fileCache.getMonitoringConfig().addProbes(
                    serverConfig.getMonitoringConfig().getFileCacheConfig().getProbes());
            builder.add(fileCacheFilter);

            final ServerFilterConfiguration config = new ServerFilterConfiguration(serverConfig);

            if (listener.isSendFileExplicitlyConfigured()) {
                config.setSendFileEnabled(listener.isSendFileEnabled());
                fileCache.setFileSendEnabled(listener.isSendFileEnabled());
            }
           
            if (listener.getScheme() != null) {
                config.setScheme(listener.getScheme());
            }
View Full Code Here

Examples of org.glassfish.grizzly.http.server.filecache.FileCache

    }

    @Override
    protected FileCache configureHttpFileCache(org.glassfish.grizzly.config.dom.FileCache cache) {
       
        final FileCache fileCache = super.configureHttpFileCache(cache);
        fileCache.getMonitoringConfig().addProbes(new FileCacheMonitor(
                grizzlyService.getMonitoring(), name, fileCache));
       
        return fileCache;
    }
View Full Code Here

Examples of org.glassfish.grizzly.http.server.filecache.FileCache

            httpServerFilter.addContentEncoding(contentEncoding);
        }
//        httpServerFilter.getMonitoringConfig().addProbes(
//                serverConfig.getMonitoringConfig().getHttpConfig().getProbes());
        filterChainBuilder.add(httpServerFilter);
        final FileCache fileCache = configureHttpFileCache(http.getFileCache());
        fileCache.initialize(obtainDelayedExecutor());
        final FileCacheFilter fileCacheFilter = new FileCacheFilter(fileCache);
//        fileCache.getMonitoringConfig().addProbes(
//                serverConfig.getMonitoringConfig().getFileCacheConfig().getProbes());
        filterChainBuilder.add(fileCacheFilter);
        final HttpServerFilter webServerFilter = new HttpServerFilter(
View Full Code Here

Examples of org.glassfish.grizzly.http.server.filecache.FileCache

    /**
     * Configure the Grizzly HTTP FileCache mechanism
     */
    protected FileCache configureHttpFileCache(org.glassfish.grizzly.config.dom.FileCache cache) {
        final FileCache fileCache = new FileCache();
        if (cache != null) {
            fileCache.setEnabled(GrizzlyConfig.toBoolean(cache.getEnabled()));
            fileCache.setSecondsMaxAge(Integer.parseInt(cache.getMaxAgeSeconds()));
            fileCache.setMaxCacheEntries(Integer.parseInt(cache.getMaxFilesCount()));
            fileCache.setMaxLargeFileCacheSize(Integer.parseInt(cache.getMaxCacheSizeBytes()));
        } else {
            fileCache.setEnabled(false);
        }
        return fileCache;
    }
View Full Code Here

Examples of org.sonar.home.cache.FileCache

  @Rule
  public ExpectedException thrown = ExpectedException.none();

  @Test
  public void should_request_list_of_plugins() {
    FileCache cache = mock(FileCache.class);
    ServerClient server = mock(ServerClient.class);
    when(server.request("/deploy/plugins/index.txt")).thenReturn("checkstyle,true\nsqale,false");
    DefaultPluginsReferential downloader = new DefaultPluginsReferential(cache, server);

    List<RemotePlugin> plugins = downloader.pluginList();
View Full Code Here

Examples of org.sonar.home.cache.FileCache

    assertThat(plugins.get(1).isCore()).isFalse();
  }

  @Test
  public void should_download_plugin() throws Exception {
    FileCache cache = mock(FileCache.class);

    File pluginJar = temp.newFile();
    when(cache.get(eq("checkstyle-plugin.jar"), eq("fakemd5_1"), any(FileCache.Downloader.class))).thenReturn(pluginJar);

    ServerClient server = mock(ServerClient.class);
    DefaultPluginsReferential downloader = new DefaultPluginsReferential(cache, server);

    RemotePlugin plugin = new RemotePlugin("checkstyle", true)
View Full Code Here

Examples of org.sonar.home.cache.FileCache

public class FileCacheProviderTest {
  @Test
  public void provide() {
    FileCacheProvider provider = new FileCacheProvider();
    FileCache cache = provider.provide(new Settings());

    assertThat(cache).isNotNull();
    assertThat(cache.getDir()).isNotNull().exists();
  }
View Full Code Here

Examples of org.sonar.home.cache.FileCache

  @Test
  public void keep_singleton_instance() {
    FileCacheProvider provider = new FileCacheProvider();
    Settings settings = new Settings();
    FileCache cache1 = provider.provide(settings);
    FileCache cache2 = provider.provide(settings);

    assertThat(cache1).isSameAs(cache2);
  }
View Full Code Here

Examples of org.sonar.home.cache.FileCache

    Thread.currentThread().setContextClassLoader(initialThreadClassloader);
  }

  @Test
  public void extend_classloader_with_jdbc_driver() throws Exception {
    FileCache cache = mock(FileCache.class);

    File fakeDriver = new File(Resources.getResource(JdbcDriverHolderTest.class, "JdbcDriverHolderTest/jdbc-driver.jar").getFile());
    when(cache.get(eq("ojdbc14.jar"), eq("fakemd5"), any(FileCache.Downloader.class))).thenReturn(fakeDriver);

    /* jdbc-driver.jar has just one file /foo/foo.txt */
    assertThat(Thread.currentThread().getContextClassLoader().getResource("foo/foo.txt")).isNull();

    ServerClient server = mock(ServerClient.class);
View Full Code Here

Examples of org.sonar.home.cache.FileCache

    assertThat(holder.getClassLoader()).isNull();
  }

  @Test
  public void do_nothing_when_jdbc_driver_file_is_empty() throws Exception {
    FileCache cache = mock(FileCache.class);

    ServerClient server = mock(ServerClient.class);
    when(server.request("/deploy/jdbc-driver.txt")).thenReturn("");

    JdbcDriverHolder holder = new JdbcDriverHolder(cache, mode, server);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.