Package org.jtester.annotations

Examples of org.jtester.annotations.SpringBeanRemote


   */
  public static void registerSpringBeanRemoteOnClient(final DefaultListableBeanFactory beanFactory,
      final Class testedClazz) {
    Set<Field> fields_HttpInvoker = AnnotationUtils.getFieldsAnnotatedWith(testedClazz, SpringBeanRemote.class);
    for (Field field : fields_HttpInvoker) {
      SpringBeanRemote springBeanRemote = field.getAnnotation(SpringBeanRemote.class);
      String beanID = springBeanRemote.value();
      if (StringHelper.isBlankOrNull(beanID)) {
        beanID = field.getName();
      }
      SpringBeanRemoteType type = SpringBeanRemoteType.getTypeFromURL(beanID);
      if (type == null) {
        type = springBeanRemote.type();
        beanID = type.name() + "/" + beanID;
      }

      if (beanFactory.containsBeanDefinition(beanID)) {
        JTesterLogger.info(String.format("spring bean[%s] has been defined in application context!", beanID));
        return;
      }
      String serviceUrl = springBeanRemote.serviceUrl();

      if (StringHelper.isBlankOrNull(serviceUrl)) {
        serviceUrl = SPRINGBEAN_REMOTE_BASEURL + "/" + beanID;
      }
      Class serviceInterface = springBeanRemote.serviceInterface();
      if (serviceInterface == null || serviceInterface == Object.class) {
        serviceInterface = field.getType();
      }

      RootBeanDefinition beanDefinition = newClientRemoteInvokerBeanDefinition(beanID, serviceUrl,
View Full Code Here


   */
  public static void injectSpringBeanRemote(final ApplicationContext ctx, Object testedObject) {
    Set<Field> fields_HttpInvoker = AnnotationUtils.getFieldsAnnotatedWith(testedObject.getClass(),
        SpringBeanRemote.class);
    for (Field field : fields_HttpInvoker) {
      SpringBeanRemote springBeanRemote = field.getAnnotation(SpringBeanRemote.class);
      String beanID = springBeanRemote.value();
      if (StringHelper.isBlankOrNull(beanID)) {
        beanID = field.getName();
      }
      SpringBeanRemoteType type = SpringBeanRemoteType.getTypeFromURL(beanID);
      if (type == null) {
        type = springBeanRemote.type();
        beanID = type.name() + "/" + beanID;
      }

      try {
        Object bean = ctx.getBean(beanID);
View Full Code Here

TOP

Related Classes of org.jtester.annotations.SpringBeanRemote

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.