Examples of Injector


Examples of org.jboss.arquillian.core.api.Injector

  
   @Before
   public void prepare()
   {
      Injector injector = injectorInst.get();
     
      when(serviceLoader.onlyOne(DeploymentScenarioGenerator.class, AnnotationDeploymentScenarioGenerator.class))
               .thenReturn(new AnnotationDeploymentScenarioGenerator());
      when(serviceLoader.onlyOne(eq(DeployableContainer.class))).thenReturn(deployableContainer);
      when(deployableContainer.getDefaultProtocol()).thenReturn(new ProtocolDescription(PROTOCOL_NAME_1));
     
      when(serviceLoader.all(eq(AuxiliaryArchiveAppender.class)))
         .thenReturn(create(AuxiliaryArchiveAppender.class, injector.inject(new TestAuxiliaryArchiveAppender())));
      when(serviceLoader.all(eq(AuxiliaryArchiveProcessor.class)))
         .thenReturn(create(AuxiliaryArchiveProcessor.class, injector.inject(new TestAuxiliaryArchiveProcessor())));
      when(serviceLoader.all(eq(ApplicationArchiveProcessor.class)))
         .thenReturn(create(ApplicationArchiveProcessor.class, injector.inject(new TestApplicationArchiveAppender())));

      containerRegistry = new LocalContainerRegistry(injector);
      protocolRegistry = new ProtocolRegistry();
     
      bind(ApplicationScoped.class, ServiceLoader.class, serviceLoader);
View Full Code Here

Examples of org.jboss.errai.ioc.rebind.ioc.Injector

            if (!instance.getInjectionContext().isInjectable(instance.getType())) {
              return false;
            }
        }

        injectorFactory.addInjector(new Injector() {
          {
            super.qualifyingMetadata = JSR299QualifyingMetadata.createFromAnnotations(instance.getQualifiers());
          }

          @Override
View Full Code Here

Examples of org.jboss.errai.ioc.rebind.ioc.injector.Injector

            @Override
            public boolean handle(final InjectableInstance instance,
                                  final Annotation annotation,
                                  final IOCProcessingContext context) {
              final List<Injector> injectors = new ArrayList<Injector>(injectionContext.getInjectors(instance.getType()));
              final Injector injector;

              final Iterator<Injector> injectorIterator = injectors.iterator();
              boolean removed = false;
              while (injectorIterator.hasNext()) {
                if (!injectorIterator.next().isEnabled()) {
                  injectorIterator.remove();
                  removed = true;
                }
              }

              if (injectors.isEmpty() && removed) {
                return true;
              }

              if (injectors.size() == 1) {
                injector = injectors.get(0);
              }
              else {
                injector = new TypeInjector(instance.getType(), injectionContext);
              }

              if (injector.isEnabled() && injector instanceof TypeInjector) {
                injector.getBeanInstance(instance);
              }
              return true;
            }
          });
          break;
        case SingletonBean:
          registerHandler(entry.getValue(), new JSR330AnnotationHandler() {
            @Override
            public boolean handle(final InjectableInstance instance,
                                  final Annotation annotation,
                                  final IOCProcessingContext context) {
              final Injector injector = injectionContext.getInjector(instance.getType());

              if (injector.isEnabled()) {
                injector.getBeanInstance(instance);
              }
              return true;
            }
          });
          break;
View Full Code Here

Examples of org.jboss.injection.Injector

    * @param annotatedElement The annotated field/method
    */
   private void addInjector(InjectionContainer container, String encName, AnnotatedElement annotatedElement)
   {
     
      Injector jndiInjector;
      if(annotatedElement instanceof Method)
      {
         BeanProperty prop = BeanPropertyFactory.create((Method) annotatedElement);
         jndiInjector = new JndiPropertyInjector(prop, encName, container.getEnc());
      }
View Full Code Here

Examples of org.jboss.injection.Injector

      }
   }
  
   private void addInjector(InjectionContainer container, String encName, AnnotatedElement annotatedElement)
   {
      Injector jndiInjector = null;
      if(annotatedElement instanceof Method)
      {
         Method method = (Method) annotatedElement;
         jndiInjector = new JndiMethodInjector(method, encName, container.getEnc());
         addInjector(container, method, method.getDeclaringClass(), jndiInjector);
View Full Code Here

Examples of org.jboss.injection.manager.spi.Injector

      {
         String bdaId = IdFactory.getIdFromClassLoader(unit.getClassLoader());
         try
         {

             Injector injector = null;
             BeanMetaDataBuilder builder = null;
             if (!unit.isComponent())
             {

                 injector = new Jsr299SimpleNonContextualInjector(bdaId);
View Full Code Here

Examples of org.ops4j.pax.exam.util.Injector

        }
    }

    private void callWithMethod(String method) throws ClassNotFoundException {
        BundleContext bundleContext = mock(BundleContext.class);
        Injector injector = mock(Injector.class);
        Bundle bundle = mock(Bundle.class);
        when(bundleContext.getBundle()).thenReturn(bundle);
        doReturn(ExceptionSource.class).when(bundle).loadClass(ExceptionSource.class.getName());
        JUnitProbeInvoker invoker = new JUnitProbeInvoker(ExceptionSource.class.getName() + ";"
            + method, bundleContext, injector);
View Full Code Here

Examples of org.shiftone.jrat.inject.Injector

    Map orderedCopyMap = new TreeMap(fileCopyMap);
    if (orderedCopyMap.size() > 0) {
      log("Copying " + orderedCopyMap.size() + " file" + ((orderedCopyMap.size() == 1) ? "" : "s") + " to "
          + destDir.getAbsolutePath(), verbosity);
      sourceFiles = orderedCopyMap.keySet().iterator();
      injector = new Injector();
      // injector.setForceOverwrite(forceOverwrite);
      // injector.setPreserveLastModified(preserveLastModified);
      while (sourceFiles.hasNext()) {
        String fromFile = (String) sourceFiles.next();
        Object to = orderedCopyMap.get(fromFile);
View Full Code Here

Examples of org.teavm.javascript.ni.Injector

    public void visit(InvocationExpr expr) {
        try {
            if (expr.getLocation() != null) {
                pushLocation(expr.getLocation());
            }
            Injector injector = getInjector(expr.getMethod());
            if (injector != null) {
                injector.generate(new InjectorContextImpl(expr.getArguments()), expr.getMethod());
            } else {
                if (expr.getType() == InvocationType.DYNAMIC) {
                    expr.getArguments().get(0).acceptVisitor(this);
                }
                String className = naming.getNameFor(expr.getMethod().getClassName());
View Full Code Here

Examples of play.api.inject.Injector

            "db.other.driver", "org.h2.Driver",
            "db.other.url", "jdbc:h2:mem:other"
        );
        running(fakeApplication(config), new Runnable() {
            public void run() {
                Injector injector = play.api.Play.current().injector();
                assertThat(injector.instanceOf(DefaultComponent.class).db.getUrl(), equalTo("jdbc:h2:mem:default"));
                assertThat(injector.instanceOf(NamedDefaultComponent.class).db.getUrl(), equalTo("jdbc:h2:mem:default"));
                assertThat(injector.instanceOf(NamedOtherComponent.class).db.getUrl(), equalTo("jdbc:h2:mem:other"));
            }
        });
    }
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.