Package ro.isdc.wro.config.jmx

Examples of ro.isdc.wro.config.jmx.WroConfiguration



  @Test
  public void shouldLoadWroConfigurationFromServletContextAttribute() throws Exception {
    final WroFilter filter = new WroFilter();
    final WroConfiguration expectedConfig = new WroConfiguration();
    final ServletContextAttributeHelper helper = new ServletContextAttributeHelper(mockServletContext);
    Mockito.when(mockServletContext.getAttribute(helper.getAttributeName(Attribute.CONFIGURATION))).thenReturn(expectedConfig);
    filter.init(mockFilterConfig);
    Assert.assertSame(expectedConfig, filter.getConfiguration());
  }
View Full Code Here


      throws Exception {
    when(mockRequest.getParameter(PARAM_RESOURCE_ID)).thenReturn(resourceId);
    when(mockRequest.getParameter(ResourceProxyRequestHandler.PATH_API)).thenReturn(ResourceProxyRequestHandler.PATH_RESOURCES);
    when(mockRequest.getRequestURI()).thenReturn(ResourceProxyRequestHandler.createProxyPath("", resourceId));

    final WroConfiguration config = new WroConfiguration();
    // we don't need caching here, otherwise we'll have clashing during unit tests.
    Context.unset();
    Context.set(Context.webContext(mockRequest, mockResponse, mockFilterConfig), newConfigWithUpdatePeriodValue(0));
    victim.init(mockFilterConfig);
    victim.doFilter(mockRequest, mockResponse, mockFilterChain);
View Full Code Here

  /**
   * Initialize {@link WroConfiguration} object with cacheUpdatePeriod & modelUpdatePeriod equal with provided argument.
   */
  private WroConfiguration newConfigWithUpdatePeriodValue(final long periodValue) {
    final WroConfiguration config = new WroConfiguration();
    config.setCacheUpdatePeriod(periodValue);
    config.setModelUpdatePeriod(periodValue);
    return config;
  }
View Full Code Here

  }

  @Test
  public void shouldNotDestroyWroModelWhenCacheIsNotDisabled()
      throws Exception {
    final WroConfiguration config = new WroConfiguration();

    prepareValidRequest(config);

    final WroModelFactory mockModelFactory = Mockito.spy(createValidModelFactory());
    victim.setWroManagerFactory(new BaseWroManagerFactory().setModelFactory(mockModelFactory));
View Full Code Here

  }

  @Test
  public void shouldNotChainWhenFilterIsEnabled()
      throws Exception {
    prepareValidRequest(new WroConfiguration());
    victim.setEnable(true);

    victim.doFilter(mockRequest, mockResponse, mockFilterChain);
    verifyChainIsNotCalled(mockFilterChain);
  }
View Full Code Here

    factory = new PropertyWroConfigurationFactory();
  }

  @Test
  public void createDefaultConfig() {
    final WroConfiguration config = factory.create();
    LOG.debug("config: {}", config);
    assertNotNull(config);
    assertEquals(0, config.getModelUpdatePeriod());
    assertEquals(0, config.getCacheUpdatePeriod());
    assertEquals(0, config.getResourceWatcherUpdatePeriod());
    assertEquals(false, config.isResourceWatcherAsync());
    assertEquals(true, config.isDebug());
    assertEquals(true, config.isGzipEnabled());
    assertEquals(true, config.isIgnoreMissingResources());
    assertEquals(true, config.isIgnoreEmptyGroup());
    assertEquals(false, config.isIgnoreFailingProcessor());
    assertEquals(true, config.isJmxEnabled());
    assertEquals(false, config.isCacheGzippedContent());
    assertEquals(false, config.isParallelPreprocessing());
    assertEquals(true, config.isMinimizeEnabled());
    assertEquals(WroConfiguration.DEFAULT_CONNECTION_TIMEOUT, config.getConnectionTimeout());
    assertEquals(WroConfiguration.DEFAULT_ENCODING, config.getEncoding());
    assertEquals(WroConfiguration.DEFAULT_CONNECTION_TIMEOUT, config.getConnectionTimeout());
  }
View Full Code Here

  public void invalidBooleanFallbacksToFalse() {
    final Properties props = new Properties();
    props.setProperty(ConfigConstants.cacheGzippedContent.name(), "INVALID_BOOLEAN");

    factory = new PropertyWroConfigurationFactory(props);
    final WroConfiguration config = factory.create();

    assertEquals(false, config.isCacheGzippedContent());
  }
View Full Code Here

    props.setProperty(ConfigConstants.connectionTimeout.name(), "5000");
    props.setProperty(ConfigConstants.minimizeEnabled.name(), "false");

    factory = new PropertyWroConfigurationFactory(props);

    final WroConfiguration config = factory.create();
    LOG.debug("config: {}", config);
    assertEquals(10, config.getCacheUpdatePeriod());
    assertEquals(20, config.getModelUpdatePeriod());
    assertEquals(30, config.getResourceWatcherUpdatePeriod());
    assertEquals(false, config.isGzipEnabled());
    assertEquals(true, config.isCacheGzippedContent());
    assertEquals(true, config.isParallelPreprocessing());
    assertEquals(false, config.isIgnoreEmptyGroup());
    assertEquals(true, config.isIgnoreFailingProcessor());
    assertEquals(5000, config.getConnectionTimeout());
    assertEquals(false, config.isMinimizeEnabled());
  }
View Full Code Here

  @Before
  public void setUp()
      throws Exception {
    initMocks(this);
    victim = DefaultWroManagerFactory.create(new WroConfiguration());
    Mockito.when(filterConfig.getServletContext()).thenReturn(servletContext);
    Mockito.when(servletContext.getResourceAsStream(Mockito.anyString())).then(createValidModelStreamAnswer());
    Context.set(Context.webContext(request, response, filterConfig));
  }
View Full Code Here

    };
  }

  @Test(expected = NullPointerException.class)
  public void cannotAcceptNullConfiguration() {
    final WroConfiguration config = null;
    DefaultWroManagerFactory.create(config);
  }
View Full Code Here

TOP

Related Classes of ro.isdc.wro.config.jmx.WroConfiguration

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.