Package ro.isdc.wro.manager

Examples of ro.isdc.wro.manager.WroManager$EmptyModelFactory


  @Test
  public void wroModelIsRetrievedCorrectly() {
    ServletContextAttributeHelper servletContextAttributeHelper = mock(ServletContextAttributeHelper.class);
    WroManagerFactory managerFactory = mock(WroManagerFactory.class);
    WroManager manager = PowerMockito.mock(WroManager.class);
    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


  public boolean isResourceChanged(final Resource resource) {
    notNull(resource, "Invalid resource provided");

    final WroManager manager = getManagerFactory().create();
    final HashStrategy hashStrategy = manager.getHashStrategy();
    final UriLocatorFactory locatorFactory = manager.getUriLocatorFactory();
    // using AtomicBoolean because we need to mutate this variable inside an anonymous class.
    final AtomicBoolean changeDetected = new AtomicBoolean(false);
    try {
      final String fingerprint = hashStrategy.getHash(locatorFactory.locate(resource.getUri()));
      final String previousFingerprint = getBuildContextHolder().getValue(resource.getUri());
View Full Code Here

   *
   * @param resource
   *          {@link Resource} to touch.
   */
  public void remember(final Resource resource) {
    final WroManager manager = getManagerFactory().create();
    final HashStrategy hashStrategy = manager.getHashStrategy();
    final UriLocatorFactory locatorFactory = manager.getUriLocatorFactory();

    if (rememberedSet.contains(resource.getUri())) {
      // only calculate fingerprints and check imports if not already done
      getLog().debug("Resource with uri '" + resource.getUri() + "' has already been updated in this run.");
    } else {
View Full Code Here

    };
    final StandaloneContext context = new StandaloneContext();
    context.setWroFile(new File("/path/to/file"));
    victim.initialize(context);
    // create one instance for test
    final WroManager manager = victim.create();
    processorsFactory = manager.getProcessorsFactory();
  }
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;
      }
    });
    manager.process();
   
    Mockito.verify(callback).onBeforeModelCreated();
    Mockito.verify(callback).onAfterModelCreated();
    Mockito.verify(callback, Mockito.atLeastOnce()).onBeforePreProcess();
    Mockito.verify(callback, Mockito.atLeastOnce()).onAfterPreProcess();
View Full Code Here

  /**
   * Creates the manager and initialize processors with locators used for assetions.
   */
  private void createManager() {
    // create one instance for test
    final WroManager manager = victim.create();
    processorsFactory = manager.getProcessorsFactory();
    uriLocatorFactory = (ConfigurableLocatorFactory) AbstractDecorator.getOriginalDecoratedObject(manager.getUriLocatorFactory());
  }
View Full Code Here

    final Properties configProperties = new Properties();
    configProperties.setProperty(ConfigurableProcessorsFactory.PARAM_PRE_PROCESSORS, alias);
    configProperties.setProperty(ConfigurableProcessorsFactory.PARAM_POST_PROCESSORS, alias);
    configProperties.setProperty(ConfigurableLocatorFactory.PARAM_URI_LOCATORS, alias);
    victim.setConfigProperties(configProperties);
    final WroManager manager = victim.create();

    assertFalse(manager.getProcessorsFactory().getPostProcessors().isEmpty());
    assertFalse(manager.getProcessorsFactory().getPreProcessors().isEmpty());
  }
View Full Code Here

  }
 
  @Test
  public void shouldCreateManager()
      throws Exception {
    final WroManager manager = victim.create();
    Assert.assertNotNull(manager);
    Assert.assertEquals(NoOpNamingStrategy.class, manager.getNamingStrategy().getClass());
  }
View Full Code Here

  @Test
  public void shouldSetCallback()
      throws Exception {
    final LifecycleCallback callback = Mockito.spy(new LifecycleCallbackSupport());
    victim = new BaseWroManagerFactory().setModelFactory(WroUtil.factoryFor(new WroModel()));
    final WroManager manager = victim.create();
    InjectorBuilder.create(victim).build().inject(manager);
   
    manager.registerCallback(new ObjectFactory<LifecycleCallback>() {
      public LifecycleCallback create() {
        return callback;
      }
    });
    manager.getModelFactory().create();
   
    Mockito.verify(callback).onBeforeModelCreated();
    Mockito.verify(callback).onAfterModelCreated();
  }
View Full Code Here

TOP

Related Classes of ro.isdc.wro.manager.WroManager$EmptyModelFactory

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.