Package ro.isdc.wro.extensions.processor.js

Examples of ro.isdc.wro.extensions.processor.js.NodeCoffeeScriptProcessor


      }
    }));
    map.put(NodeCoffeeScriptProcessor.ALIAS, new LazyProcessorDecorator(new LazyInitializer<ResourcePreProcessor>() {
      @Override
      protected ResourcePreProcessor initialize() {
        return new NodeCoffeeScriptProcessor();
      }
    }));
    map.put(CoffeeScriptProcessor.ALIAS, new LazyProcessorDecorator(new LazyInitializer<ResourcePreProcessor>() {
      @Override
      protected ResourcePreProcessor initialize() {
View Full Code Here


public class TestNodeCoffeeScriptProcessor {
  private static boolean isSupported = false;
  @BeforeClass
  public static void beforeClass() {
    //initialize this field only once.
    isSupported = new NodeCoffeeScriptProcessor().isSupported();
  }
View Full Code Here

  }

  @Test
  public void shouldCompileAllFromFolder()
      throws Exception {
    final ResourcePreProcessor processor = new NodeCoffeeScriptProcessor();
    final URL url = getClass().getResource("coffeeScript/advanced");

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

  }

  @Test
  public void shouldCompileAllFromFolderUsingBareOption()
      throws Exception {
    final ResourcePreProcessor processor = new NodeCoffeeScriptProcessor() {
      @Override
      protected String[] buildOptionalArguments() {
        return new String[] {"--bare"};
      }
    };
View Full Code Here

    WroTestUtils.compareFromDifferentFoldersByExtension(testFolder, expectedFolder, "js", processor);
  }

  @Test
  public void shouldBeThreadSafe() throws Exception {
    final NodeCoffeeScriptProcessor processor = new NodeCoffeeScriptProcessor() {
      @Override
      protected void onException(final Exception e, final String content) {
        throw WroRuntimeException.wrap(e);
      }
    };
    final Callable<Void> task = new Callable<Void>() {
      @Override
      public Void call() {
        try {
          processor.process(new StringReader("square = (x) -> x * x"), new StringWriter());
        } catch (final Exception e) {
          throw new RuntimeException(e);
        }
        return null;
      }
View Full Code Here

   * Test that processing invalid less css produces exceptions
   */
  @Test
  public void shouldFailWhenInvalidScriptIsProcessed()
      throws Exception {
    final ResourcePreProcessor processor = new NodeCoffeeScriptProcessor();
    final URL url = getClass().getResource("coffeeScript/exceptions");

    final File testFolder = new File(url.getFile(), "test");
    WroTestUtils.forEachFileInFolder(testFolder, new Function<File, Void>() {
      @Override
      public Void apply(final File input)
          throws Exception {
        try {
          processor.process(null, new FileReader(input), new StringWriter());
          Assert.fail("Expected to fail, but didn't");
        } catch (final WroRuntimeException e) {
          //expected to throw exception, continue
        }
        return null;
View Full Code Here

  @Test
  public void testExceptions()
    throws IOException {
    final URL url = getClass().getResource("coffeeScript/exceptions");
    final AtomicInteger counter = new AtomicInteger();
    final ResourcePreProcessor processor = new ExceptionHandlingProcessorDecorator(new NodeCoffeeScriptProcessor() {
      @Override
      protected void onException(final Exception e, final String content) {
        counter.incrementAndGet();
        throw WroRuntimeException.wrap(e);
      }
View Full Code Here

    Assert.assertEquals(2, counter.get());
  }

  @Test
  public void shouldSupportCorrectResourceTypes() {
    WroTestUtils.assertProcessorSupportResourceTypes(new NodeCoffeeScriptProcessor(), ResourceType.JS);
  }
View Full Code Here

TOP

Related Classes of ro.isdc.wro.extensions.processor.js.NodeCoffeeScriptProcessor

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.