Package ro.isdc.wro.config.jmx

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


      // mock response
      final HttpServletResponse response = Mockito.mock(HttpServletResponse.class);
      Mockito.when(response.getOutputStream()).thenReturn(new DelegatingServletOutputStream(new NullOutputStream()));

      // init context
      final WroConfiguration config = Context.get().getConfig();
      Context.set(Context.webContext(request, response, Mockito.mock(FilterConfig.class)), config);
      // perform processing
      getManagerFactory().create().process();

      getLog().debug("Processing group: " + group + " [OK]");
View Full Code Here


      final HttpServletResponse response = Mockito.mock(HttpServletResponse.class);
      resultOutputStream = new ByteArrayOutputStream();
      Mockito.when(response.getOutputStream()).thenReturn(new DelegatingServletOutputStream(resultOutputStream));

      // init context
      final WroConfiguration config = Context.get().getConfig();
      // the maven plugin should ignore empty groups, since it will try to process all types of resources.
      config.setIgnoreEmptyGroup(true);
      Context.set(Context.webContext(request, response, Mockito.mock(FilterConfig.class)), config);

      Context.get().setAggregatedFolderPath(getAggregatedPathResolver().resolve());
      // perform processing
      getManagerFactory().create().process();
View Full Code Here

  @Test
  public void shouldBeConfiguredBySpring()
      throws Exception {
    filter.init(mockFilterConfig);
    final WroConfiguration config = filter.getConfiguration();
    assertEquals(10, config.getCacheUpdatePeriod());
    assertEquals(20, config.getModelUpdatePeriod());
    assertEquals(false, config.isGzipEnabled());
    assertEquals(true, config.isDebug());
    assertEquals(false, config.isIgnoreMissingResources());
    assertEquals(false, config.isJmxEnabled());
  }
View Full Code Here

    assertEquals(NoProcessorsWroManagerFactory.class, victim.getFactory().getClass());
  }

  @Test(expected = WroRuntimeException.class)
  public void cannotCreateInvalidConfiguredManagerFactory() {
    final WroConfiguration config = new WroConfiguration();
    config.setWroManagerClassName("invalid.class.name.ManagerFactory");
    victim = DefaultWroManagerFactory.create(config);
  }
View Full Code Here

    assertEquals(etag, map.get(HttpHeader.ETAG.getHeaderName()));
  }
 
  @Test
  public void shouldHaveNoCacheHeadersInDebugMode() {
    final WroConfiguration config = new WroConfiguration();
    config.setDebug(true);
    victim = ResponseHeadersConfigurer.fromConfig(config);
   
    final Map<String, String> map = victim.getHeadersMap();
    assertEquals(3, map.size());
    assertEquals("no-cache", map.get(HttpHeader.PRAGMA.getHeaderName()));
View Full Code Here

    assertEquals("0", map.get(HttpHeader.EXPIRES.getHeaderName()));
  }
 
  @Test
  public void shouldSetCacheControlForOneYearWhenDebugModeIsFalse() {
    final WroConfiguration config = new WroConfiguration();
    config.setDebug(false);
    victim = ResponseHeadersConfigurer.fromConfig(config);
   
    final Map<String, String> map = victim.getHeadersMap();
    assertEquals(3, map.size());
    assertEquals("public, max-age=315360000", map.get(HttpHeader.CACHE_CONTROL.getHeaderName()));
View Full Code Here

    assertEquals(2, map.size());
  }
 
  @Test(expected = WroRuntimeException.class)
  public void cannotUseHeadersSetWronglyAsString() {
    final WroConfiguration config = new WroConfiguration();
    config.setDebug(true);
    config.setHeader("h1=v1 , h2 =v2");
    victim = ResponseHeadersConfigurer.fromConfig(config);
   
    final Map<String, String> map = victim.getHeadersMap();
    assertEquals(2, map.size());
    assertEquals("v1", map.get("h1"));
View Full Code Here

  }

  @Test
  public void shouldGetAttribute() {
    final Attribute attr = Attribute.CONFIGURATION;
    final WroConfiguration value = new WroConfiguration();
    Mockito.when(mockServletContext.getAttribute(victim.getAttributeName(attr))).thenReturn(value);
    Assert.assertSame(value, victim.getAttribute(attr));
  }
View Full Code Here

    victim.setAttribute(Attribute.MANAGER_FACTORY, "invalid type");
  }

  @Test
  public void shouldStoreAttributeOfValidType() {
    victim.setAttribute(Attribute.CONFIGURATION, new WroConfiguration());
  }
View Full Code Here

    setConfigurationMode(FilterConfigWroConfigurationFactory.PARAM_VALUE_DEPLOYMENT);
    when(mockFilterConfig.getInitParameter(ConfigConstants.gzipResources.name())).thenReturn("false");
    when(mockFilterConfig.getInitParameter(ConfigConstants.cacheUpdatePeriod.name())).thenReturn("10");
    when(mockFilterConfig.getInitParameter(ConfigConstants.modelUpdatePeriod.name())).thenReturn("100");
    victim.init(mockFilterConfig);
    final WroConfiguration config = victim.getConfiguration();
    assertEquals(false, config.isDebug());
    assertEquals(false, config.isGzipEnabled());
    assertEquals(10, config.getCacheUpdatePeriod());
    assertEquals(100, config.getModelUpdatePeriod());
  }
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.