Package ro.isdc.wro.model.resource.processor

Examples of ro.isdc.wro.model.resource.processor.ResourcePreProcessor


    assertTrue(new ProcessorDecorator(noOpProcessor).isEligible(false, ResourceType.JS));
  }

  @Test
  public void shouldChangeMinimizaFlagWhenInternalMethodIsOverriden() {
    final ResourcePreProcessor processor = new ProcessorDecorator(new JSMinProcessor()) {
      @Override
      protected boolean isMinimizeInternal() {
        return false;
      }
    };
View Full Code Here


    assertFalse(new ProcessorDecorator(processor).isMinimize());
  }

  @Test
  public void shouldChangeSupportedTypesWhenInternalMethodIsOverriden() {
    final ResourcePreProcessor processor = new ProcessorDecorator(new JSMinProcessor()) {
      @Override
      protected SupportedResourceType getSupportedResourceTypeInternal() {
        return null;
      }
    };
View Full Code Here

  }
 
  @Test
  public void shouldApplyProcessorOnlyOnResourcesWithExtensionJs()
      throws Exception {
    final ResourcePreProcessor decoratedProcessor = new JSMinProcessor();
    final ResourcePreProcessor processor = ExtensionsAwareProcessorDecorator.decorate(decoratedProcessor).addExtension(
        "js");
    WroTestUtils.createInjector().inject(processor);
    // we use test resource relative to TestProcessorsUtils class
    final URL url = ResourcePreProcessor.class.getResource("extensionAware");
   
View Full Code Here

    WroTestUtils.compareFromDifferentFolders(testFolder, expectedFolder, processor);
  }
 
  @Test(expected = NullPointerException.class)
  public void cannotAcceptNullExtension() {
    final ResourcePreProcessor decoratedProcessor = new JSMinProcessor();
    ExtensionsAwareProcessorDecorator.decorate(decoratedProcessor).addExtension(null);
  }
View Full Code Here

    ExtensionsAwareProcessorDecorator.decorate(decoratedProcessor).addExtension(null);
  }
 
  @Test
  public void testMinimizeAwareDecorator1() {
    final ResourcePreProcessor decoratedProcessor = new JSMinProcessor();
    final ResourcePreProcessor processor = ExtensionsAwareProcessorDecorator.decorate(decoratedProcessor);
    Assert.assertTrue(new ProcessorDecorator(processor).isMinimize());
  }
View Full Code Here

    Assert.assertTrue(new ProcessorDecorator(processor).isMinimize());
  }
 
  @Test
  public void testMinimizeAwareDecorator2() {
    final ResourcePreProcessor decoratedProcessor = new CssUrlRewritingProcessor();
    final ResourcePreProcessor processor = ExtensionsAwareProcessorDecorator.decorate(decoratedProcessor);
    Assert.assertFalse(new ProcessorDecorator(processor).isMinimize());
  }
View Full Code Here

  }

  @Test
  public void shouldInvokeMinimizePreProcessorWhenMinimizeIsRequired()
      throws Exception {
    final ResourcePreProcessor processor = Mockito.spy(new JSMinProcessor());
    victim = new MinimizeAwareProcessorDecorator(processor, true);
    initVictim();
    victim.process(mockReader, mockWriter);
    Mockito.verify(processor, Mockito.atLeastOnce()).process(Mockito.any(Resource.class), Mockito.any(Reader.class),
        Mockito.any(Writer.class));
View Full Code Here

  }

  @Test
  public void shouldNotInvokeMinimizePreProcessorWhenMinimizeIsNotRequired()
      throws Exception {
    final ResourcePreProcessor processor = Mockito.spy(new JSMinProcessor());
    victim = new MinimizeAwareProcessorDecorator(processor, false);
    initVictim();
    victim.process(mockReader, mockWriter);
    Mockito.verify(processor, Mockito.never()).process(Mockito.any(Resource.class), Mockito.any(Reader.class),
        Mockito.any(Writer.class));
View Full Code Here

  }

  @Test
  public void shouldLeaveContentUnchangedWhenProcessorIsSkipped()
      throws Exception {
    final ResourcePreProcessor processor = Mockito.spy(new JSMinProcessor());
    victim = new MinimizeAwareProcessorDecorator(processor, false);
    initVictim();
    final String resourceContent = "var i      =     1;";
    final StringWriter writer = new StringWriter();
    victim.process(new StringReader(resourceContent), writer);
View Full Code Here

  }

  @Test
  public void shouldInjectDecoratedProcessor() {
    final TestProcessor testProcessor = new TestProcessor();
    final ResourcePreProcessor processor = CopyrightKeeperProcessorDecorator.decorate(testProcessor);

    final Injector injector = InjectorBuilder.create(new BaseWroManagerFactory()).build();
    injector.inject(processor);
    assertNotNull(testProcessor.context);
  }
View Full Code Here

TOP

Related Classes of ro.isdc.wro.model.resource.processor.ResourcePreProcessor

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.