Package ro.isdc.wro.manager.factory

Examples of ro.isdc.wro.manager.factory.WroManagerFactory.create()


    WroModelFactory modelFactory = mock(WroModelFactory.class);

    WroModel modelFromTest = new WroModel();

    when(servletContextAttributeHelper.getManagerFactory()).thenReturn(managerFactory);
    when(managerFactory.create()).thenReturn(manager);
    when(manager.getModelFactory()).thenReturn(modelFactory);
    when(modelFactory.create()).thenReturn(modelFromTest);

    WroTagLibConfig wroTagLibConfig = new WroTagLibConfig(this.servletContext);
    WroModel modelFromConfig = wroTagLibConfig.getModel(servletContextAttributeHelper);
View Full Code Here


    properties.setProperty(ConfigurableProcessorsFactory.PARAM_POST_PROCESSORS, RhinoCoffeeScriptProcessor.ALIAS);
    filter.setProperties(properties);
    filter.init(mockFilterConfig);

    final WroManagerFactory factory = filter.newWroManagerFactory();
    final WroManager wroManager = factory.create();

    final ProcessorsFactory processorsFactory = wroManager.getProcessorsFactory();
    final Collection<ResourcePostProcessor> postProcessors = processorsFactory.getPostProcessors();

    assertEquals(1, postProcessors.size());
View Full Code Here

      final ConfigurableWroFilter filter = new ConfigurableWroFilter() {
        @Override
        protected WroManagerFactory newWroManagerFactory() {
          final WroManagerFactory original = super.newWroManagerFactory();
          try {
            original.create().getProcessorsFactory().getPreProcessors();
          } catch (final Exception e) {
            LOG.debug("caught exception: ", e);
            processorsCreationException.set(e);
          }
          return original;
View Full Code Here

          }
        };
      }
    };
    filter.init(mockFilterConfig);
    final WroModelFactory modelFactory = wroManagerFactory.create().getModelFactory();

    assertTrue(modelFactory.create().getGroups().isEmpty());

    // reload model
    Context.get().getConfig().reloadModel();
View Full Code Here

    victim.setWroManagerFactory(null);
    victim.init(mockFilterConfig);
    Context.unset();
    Context.set(Context.webContext(mockRequest, mockResponse, mockFilterConfig), configurationFactory.create());
    final WroManagerFactory factory = victim.getWroManagerFactory();
    assertEquals(1, factory.create().getProcessorsFactory().getPreProcessors().size());
  }

  @Test
  public void shouldNotFailWhenInvokedConcurrently() throws Exception {
    final String requestUri = "/folder/g1.css";
View Full Code Here

    group.addResource(Resource.create("classpath:1.js"));
    final WroModelFactory modelFactory = WroUtil.factoryFor(new WroModel().addGroup(group));
   
    final WroManagerFactory managerFactory = new BaseWroManagerFactory().setGroupExtractor(groupExtractor).setModelFactory(
        modelFactory);
    final WroManager manager = managerFactory.create();
    manager.registerCallback(new ObjectFactory<LifecycleCallback>() {
      public LifecycleCallback create() {
        return callback;
      }
    });
View Full Code Here

          return resource.getType();
        }
      };
      // this manager will make sure that we always process a model holding one group which has only one resource.
      final WroManagerFactory managerFactory = createManagerFactory(resource).setGroupExtractor(groupExtractor);
      managerFactory.create().process();
    }
  }

  private class GenericTestBuilder {
    /**
 
View Full Code Here

    Mockito.when(response.getOutputStream()).thenReturn(new DelegatingServletOutputStream(out));
    Mockito.when(request.getRequestURI()).thenReturn("/app/g1.css");
    Context.unset();
    Context.set(Context.webContext(request, response, Mockito.mock(FilterConfig.class)));

    factory.create().process();

    // compare written bytes to output stream with the content from specified css.
    WroTestUtils.compare(WroTestUtils.getInputStream("classpath:ro/isdc/wro/manager/noProcessorsResult.css"),
        new ByteArrayInputStream(out.toByteArray()));
  }
View Full Code Here

    Context.set(Context.webContext(request, response, Mockito.mock(FilterConfig.class)), config);

    final WroModel model = new WroModel();
    model.addGroup(new Group("noResources"));
    final WroManagerFactory managerFactory = new BaseWroManagerFactory().setModelFactory(WroUtil.factoryFor(model));
    managerFactory.create().process();
  }

  @Test
  public void testCRC32Fingerprint()
      throws Exception {
View Full Code Here

  @Test
  public void testCRC32Fingerprint()
      throws Exception {
    final WroManagerFactory factory = new BaseWroManagerFactory().setModelFactory(getValidModelFactory()).setHashStrategy(
        new CRC32HashStrategy());
    final WroManager manager = factory.create();
    final String path = manager.encodeVersionIntoGroupPath("g3", ResourceType.CSS, true);
    assertEquals("1d62dbaf/g3.css?minimize=true", path);
  }

  @Test
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.