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

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


  public static final class ExceptionThrowingWroManagerFactory
      extends DefaultStandaloneContextAwareManagerFactory {
    @Override
    protected ProcessorsFactory newProcessorsFactory() {
      final SimpleProcessorsFactory factory = new SimpleProcessorsFactory();
      final ResourcePostProcessor postProcessor = Mockito.mock(ResourcePostProcessor.class);
      try {
        Mockito.doThrow(new RuntimeException()).when(postProcessor).process(Mockito.any(Reader.class),
            Mockito.any(Writer.class));
      } catch (final IOException e) {
        Assert.fail("never happen");
View Full Code Here


  }

  @Test
  public void testFromFolder()
      throws Exception {
    final ResourcePostProcessor processor = new NodeTypeScriptProcessor();
    final URL url = getClass().getResource("typescript");

    final File testFolder = new File(url.getFile(), "test");
    final File expectedFolder = new File(url.getFile(), "expected");
    WroTestUtils.compareFromDifferentFoldersByExtension(testFolder, expectedFolder, "js", processor);
View Full Code Here

  }

  @Test(expected = LinterException.class)
  public void testWithOptionsSet()
      throws Exception {
    final ResourcePostProcessor processor = new JsLintProcessor() {
      @Override
      protected void onLinterException(final LinterException e, final Resource resource) {
        throw e;
      };
    }.setOptionsAsString("maxerr=1");

    processor.process(new StringReader("alert(;"), new StringWriter());
  }
View Full Code Here

  }

  @Test(expected = LinterException.class)
  public void shouldFailWhenScriptContainsErrors()
      throws Exception {
    final ResourcePostProcessor processor = new JsLintProcessor() {
      @Override
      protected void onLinterException(final LinterException e, final Resource resource) {
        throw e;
      }
      @Override
      protected String createDefaultOptions() {
        return "maxerr=1";
      }
    };
    processor.process(new StringReader("alert(;"), new StringWriter());
  }
View Full Code Here

* @created Created on Apr 21, 2010
*/
public class TestBeautifyJsProcessor {
  @Test
  public void testFromFolder() throws IOException {
    final ResourcePostProcessor processor = new BeautifyJsProcessor();
    final URL url = getClass().getResource("beautify");

    final File testFolder = new File(url.getFile(), "test");
    final File expectedFolder = new File(url.getFile(), "expected");
    WroTestUtils.compareFromDifferentFoldersByExtension(testFolder, expectedFolder, "js", processor);
View Full Code Here

  }

  @Test
  public void testFromFolder()
      throws Exception {
    final ResourcePostProcessor processor = new NodeLessCssProcessor();
    final URL url = getClass().getResource("lesscss");

    final File testFolder = new File(url.getFile(), "test");
    final File expectedFolder = new File(url.getFile(), "expectedNode");
    WroTestUtils.compareFromDifferentFoldersByExtension(testFolder, expectedFolder, "css", processor);
View Full Code Here

public class TestSassCssProcessor {
  @Test
  public void testFromFolder()
    throws IOException {
    final URL url = getClass().getResource("sasscss");
    final ResourcePostProcessor processor = new SassCssProcessor();

    final File testFolder = new File(url.getFile(), "test");
    final File expectedFolder = new File(url.getFile(), "expected");
    WroTestUtils.compareFromDifferentFoldersByExtension(testFolder, expectedFolder, "css", processor);
  }
View Full Code Here

  @Test
  public void testLessCompiler()
      throws Exception {
    final String resourceUri = "classpath:" + LESS_INPUT_NAME;
    WroTestUtils.compareProcessedResourceContents(resourceUri, "classpath:" + LESS_OUTPUT_NAME,
        new ResourcePostProcessor() {
          @Override
          public void process(final Reader reader, final Writer writer)
              throws IOException {
            // Sample URLs that the CSS URL rewriter does not authorize... make sure we still don't:
            final String badUri = "classpath:test/@{iconSpritePath}";
View Full Code Here

  @Test
  public void testWithOptionsSet()
      throws Exception {
    final ThreadLocal<Throwable> cause = new ThreadLocal<Throwable>();

    final ResourcePostProcessor processor = new JsHintProcessor() {
      @Override
      protected void onLinterException(final LinterException e, final Resource resource) {
        cause.set(e);
      };
    }.setOptionsAsString("maxerr=1");

    processor.process(new StringReader("alert(;"), new StringWriter());
    Assert.assertNotNull(cause.get());
  }
View Full Code Here

  }

  @Test
  public void shouldUglifyFiles()
      throws IOException {
    final ResourcePostProcessor processor = new UglifyJsProcessor();
    final URL url = getClass().getResource("uglify");

    final File expectedFolder = new File(url.getFile(), "expected");
    WroTestUtils.compareFromDifferentFoldersByExtension(testFolder, expectedFolder, "js", processor);
  }
View Full Code Here

TOP

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

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.