Package ro.isdc.wro.manager.factory

Examples of ro.isdc.wro.manager.factory.BaseWroManagerFactory


  public void setUp() {
    MockitoAnnotations.initMocks(this);
    Context.set(Context.standaloneContext());
    transformer = new WildcardExpanderModelTransformer();
    // create manager to force correct initialization.
    final BaseWroManagerFactory factory = new BaseWroManagerFactory();
    factory.setProcessorsFactory(processorsFactory);
    factory.addModelTransformer(transformer);
    final Injector injector = InjectorBuilder.create(factory).build();
    injector.inject(transformer);
  }
View Full Code Here


    new InjectorBuilder(null);
  }

  @Test
  public void shouldBuildInjectorWithValidWroManager() {
    final Injector injector = InjectorBuilder.create(new BaseWroManagerFactory()).build();
    assertNotNull(injector);

    final Sample sample = new Sample();
    injector.inject(sample);
    assertNotNull(sample.namingStrategy);
View Full Code Here

    assertNotNull(sample.dispatcherLocator);
  }

  @Test
  public void shouldBuildValidInjectorWithBaseWroManagerFactory() {
    final Injector injector = InjectorBuilder.create(new BaseWroManagerFactory()).build();
    assertNotNull(injector);

    final Sample sample = new Sample();
    injector.inject(sample);
    assertNotNull(sample.namingStrategy);
View Full Code Here

    final NamingStrategy mockNamingStrategy = mock(NamingStrategy.class);
    final ProcessorsFactory mockProcessorsFactory = mock(ProcessorsFactory.class);
    final UriLocatorFactory mockLocatorFactory = mock(UriLocatorFactory.class);
    final MetaDataFactory mockMetaDataFactory = Mockito.mock(MetaDataFactory.class);

    final BaseWroManagerFactory managerFactroy = new BaseWroManagerFactory();
    managerFactroy.setNamingStrategy(mockNamingStrategy);
    managerFactroy.setProcessorsFactory(mockProcessorsFactory);
    managerFactroy.setUriLocatorFactory(mockLocatorFactory);
    managerFactroy.setMetaDataFactory(mockMetaDataFactory);

    final Injector injector = InjectorBuilder.create(managerFactroy).build();
    assertNotNull(injector);

    final Sample sample = new Sample();
View Full Code Here

  @Test(expected = IOException.class)
  public void shouldInjectEachLocatorProvidedByLocatorFactory()
      throws Exception {
    final UriLocatorFactory uriLocatorFactory = new DefaultUriLocatorFactory();
    final WroManagerFactory managerFactory = new BaseWroManagerFactory().setUriLocatorFactory(uriLocatorFactory);
    final Injector injector = InjectorBuilder.create(managerFactory).build();

    final Sample sample = new Sample();
    injector.inject(sample);
    // this will throw NullPointerException if the uriLocator is not injected.
View Full Code Here

    assertEquals(timeout, sample.dispatcherLocator.getTimeout());
  }

  private Injector createDefaultInjector() {
    return new InjectorBuilder(new BaseWroManagerFactory()).build();
  }
View Full Code Here

  public void shouldAcceptInjectInitializedManager() {
    initializeValidInjector();
  }

  private void initializeValidInjector() {
    victim = InjectorBuilder.create(new BaseWroManagerFactory()).build();
  }
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

  }
 
  @Before
  public void setUp() {
    Context.set(Context.standaloneContext());
    injector = InjectorBuilder.create(new BaseWroManagerFactory()).build();
    // required to get the authManager and make assertions agains it.
    injector.inject(this);
  }
View Full Code Here

    notNull(environment, "The application's environment is required.");
    notNull(mode, "The application's descriptor is required.");
    notNull(processorsFactory, "The processor's factory is required.");
    notNull(uriLocatorFactory, "The uri locator factory is required.");

    final BaseWroManagerFactory wroManagerFactory = new BaseWroManagerFactory();

    wroManagerFactory
        .setUriLocatorFactory(uriLocatorFactory)
        .setModelFactory(new WildcardModelFactory(
            applicationContext, wroModelFactory));

    List<Transformer> transformers =
        Beans.lookFor(applicationContext, Transformer.class);

    GroupExtractor groupExtractor =
        Beans.get(applicationContext, GroupExtractor.class);

    boolean useDefaults =
        transformers.size() == 0 && groupExtractor == null;

    if (useDefaults) {
      mode.execute(new ModeCallback<Object>() {
        @Override
        public Object onDev() {
          GroupPerFileModel groupPerFileModel = new GroupPerFileModel();
          wroManagerFactory.addModelTransformer(groupPerFileModel);
          wroManagerFactory.setGroupExtractor(groupPerFileModel);
          return null;
        }

        @Override
        public Object on(final Mode mode) {
          return null;
        }
      });
    } else {
      for (Transformer transformer : transformers) {
        wroManagerFactory.addModelTransformer(transformer);
      }
      if (groupExtractor != null) {
        wroManagerFactory.setGroupExtractor(groupExtractor);
      }
    }

    wroManagerFactory.setProcessorsFactory(
        processorsFactory(mode, processorsFactory, uriLocatorFactory,
            environment));

    return wroManagerFactory;
  }
View Full Code Here

TOP

Related Classes of ro.isdc.wro.manager.factory.BaseWroManagerFactory

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.