Package br.com.caelum.vraptor

Examples of br.com.caelum.vraptor.ComponentRegistry.register()


    executeInsideRequest(new WhatToDo<Object>() {
      public Object execute(RequestInfo request, int counter) {
        return provider.provideForRequest(request, new Execution<Object>() {
          public Object insideRequest(Container container) {
            ComponentRegistry registry = container.instanceFor(ComponentRegistry.class);
            registry.register(MyPrototypeComponent.class, MyPrototypeComponent.class);

            MyPrototypeComponent instance1 = instanceFor(MyPrototypeComponent.class,container);
            MyPrototypeComponent instance2 = instanceFor(MyPrototypeComponent.class,container);
            assertThat(instance1, not(sameInstance(instance2)));
            return null;
View Full Code Here


      public T execute(RequestInfo request, final int counter) {
        return provider.provideForRequest(request, new Execution<T>() {
          public T insideRequest(Container secondContainer) {
            if (componentToRegister != null && !isAppScoped(secondContainer, componentToRegister)) {
              ComponentRegistry registry = secondContainer.instanceFor(ComponentRegistry.class);
              registry.register(componentToRegister, componentToRegister);
            }

            ResourceMethod secondMethod = mock(ResourceMethod.class, "rm" + counter);
            secondContainer.instanceFor(MethodInfo.class).setResourceMethod(secondMethod);
            return instanceFor(component, secondContainer);
View Full Code Here

        return provider.provideForRequest(request, new Execution<T>() {
          public T insideRequest(Container firstContainer) {
            if (componentToRegister != null) {
              ComponentRegistry registry = firstContainer.instanceFor(ComponentRegistry.class);
              registry.register(componentToRegister, componentToRegister);
            }
            ResourceMethod firstMethod = mock(ResourceMethod.class, "rm" + counter);
            firstContainer.instanceFor(MethodInfo.class).setResourceMethod(firstMethod);
            return instanceFor(componentToBeRetrieved,firstContainer);
          }
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.