@Override
 public ModulesBuilder prepare(ModulesBuilder builder) {
   log.log(PLUGIN_MESSAGE_RESOURCE, "IACF000001");
   builder.addRequestValueResolverClass(MultipartParameterResolver.class);
   builder.addRequestValueResolverClass(MultipartParameterStreamResolver.class);
   return builder;
 }
Ejemplo n.º 2
0
  @Test
  public void testIgnoreModulesByFilter() {
    final ContainerAdaptor defaultAdaptor = mock(ContainerAdaptor.class);
    ProcessorA a = new ProcessorA();
    final ProcessorB b = new ProcessorB();
    ProcessorC c = new ProcessorC();
    List<ApplicationProcessor> processors = new ArrayList<ApplicationProcessor>();
    processors.add(a);
    processors.add(b);
    processors.add(c);
    when(defaultAdaptor.getInstancesOfType(ApplicationProcessor.class)).thenReturn(processors);
    ca = defaultAdaptor;
    builder.setModulesProviderClass(MockContainerAdaptorFactory.class);
    builder.addApplicationProcessorClass(ApplicationProcessor.class);
    MultiModule.Filter filter =
        new MultiModule.Filter() {

          @Override
          public boolean isAppreciable(MultiModule aMultiModule) {
            if (aMultiModule == b) {
              return false;
            }
            return true;
          }
        };
    builder.filter(filter);
    Modules modules = builder.buildModules(resolver, defaultAdaptor);
    List<ApplicationProcessor> actual = modules.getApplicationProcessors();
    log.debug(actual.toString());
    assertThat(actual.size(), is(2));
  }
Ejemplo n.º 3
0
 @Test
 public void testIgnoreModules() {
   final ContainerAdaptor defaultAdaptor = mock(ContainerAdaptor.class);
   List<ApplicationProcessor> processors = new ArrayList<ApplicationProcessor>();
   processors.add(new ProcessorA());
   processors.add(new ProcessorB());
   processors.add(new ProcessorC());
   when(defaultAdaptor.getInstancesOfType(ApplicationProcessor.class)).thenReturn(processors);
   ca = defaultAdaptor;
   builder.setModulesProviderClass(MockContainerAdaptorFactory.class);
   builder.addApplicationProcessorClass(ApplicationProcessor.class);
   Modules modules = builder.buildModules(resolver, defaultAdaptor);
   List<ApplicationProcessor> actual = modules.getApplicationProcessors();
   log.debug(actual.toString());
   assertThat(actual.size(), is(3));
   builder.ignore(ProcessorB.class);
   modules = builder.buildModules(resolver, defaultAdaptor);
   actual = modules.getApplicationProcessors();
   log.debug(actual.toString());
   assertThat(actual.size(), is(1));
 }
Ejemplo n.º 4
0
 @Test
 public void testOptionalModulesFound() {
   ContainerAdaptor defaultAdaptor = mock(ContainerAdaptor.class);
   ApplicationProcessor foundProcessor = mock(ApplicationProcessor.class);
   List<ApplicationProcessor> processors = Arrays.asList(foundProcessor);
   when(defaultAdaptor.getInstancesOfType(ApplicationProcessor.class)).thenReturn(processors);
   builder.addApplicationProcessorClass(ApplicationProcessor.class);
   builder.setModulesProviderClass(MockModulesProvidingContainerAdaptorFactory.class);
   Modules modules = builder.buildModules(resolver, defaultAdaptor);
   adaptor.unregister(ApplicationProcessor.class);
   List<ApplicationProcessor> actual = modules.getApplicationProcessors();
   log.debug(actual.toString());
   assertThat(actual.size(), is(1));
   assertThat(actual.get(0), is(foundProcessor));
 }
Ejemplo n.º 5
0
 @Test
 @SuppressWarnings("unchecked")
 public void testOptionalModuleFound() {
   ContainerAdaptor defaultAdaptor = mock(ContainerAdaptor.class);
   Invoker foundInvoker = mock(Invoker.class);
   InvokerFactory factory = mock(InvokerFactory.class);
   when(factory.createInvoker(isA(List.class))).thenReturn(foundInvoker);
   when(defaultAdaptor.getInstanceOfType(InvokerFactory.class)).thenReturn(factory);
   builder.setInvokerFactoryClass(InvokerFactory.class);
   builder.setModulesProviderClass(MockModulesProvidingContainerAdaptorFactory.class);
   Modules modules = builder.buildModules(resolver, defaultAdaptor);
   adaptor.unregister(Invoker.class);
   builder.setTypeMapperContextClass(typeMapperContext.getClass());
   Invoker actual = modules.getInvoker();
   log.debug(actual.toString());
   assertThat(actual, is(foundInvoker));
 }
 @Override
 public ModulesBuilder prepare(ModulesBuilder builder) {
   log.log(PLUGIN_MESSAGE_RESOURCE, "IGB000001");
   builder.setInvocationInstanceProviderClass(GuiceContainerAdaptorFactory.class);
   return builder;
 }