Examples of GwtTestResourcesException


Examples of com.googlecode.gwt.test.exceptions.GwtTestResourcesException

   private String text;
   private List<URL> urls;

   private ResourcePrototypeProxyBuilder(Class<?> proxiedClass, Class<?> ownerClass) {
      if (!proxiedClass.isInterface()) {
         throw new GwtTestResourcesException("Cannot create a resource proxy instance for '"
                  + proxiedClass.getName() + "' because it is not an interface");
      }
      this.proxiedClass = proxiedClass;
      this.ownerClass = ownerClass;
   }
View Full Code Here

Examples of com.googlecode.gwt.test.exceptions.GwtTestResourcesException

      } else if (DataResource.class.isAssignableFrom(proxiedClass)) {
         callback = new DataResourceCallback(computeUrl(urls, ownerClass));
      } else if (ImageResource.class.isAssignableFrom(proxiedClass)) {
         callback = new ImageResourceCallback(computeImageUrl(urls, ownerClass));
      } else {
         throw new GwtTestResourcesException("Not managed return type for ClientBundle : "
                  + proxiedClass.getName());
      }

      InvocationHandler resourceInvocationHandler = generateInvocationHandler(callback);
      return Proxy.newProxyInstance(this.getClass().getClassLoader(), new Class<?>[]{proxiedClass},
View Full Code Here

Examples of com.googlecode.gwt.test.exceptions.GwtTestResourcesException

      return this;
   }

   private String computeImageUrl(List<URL> resourceURLs, Class<?> resourceClass) {
      if (resourceURLs.size() > 1) {
         throw new GwtTestResourcesException("Too many ImageResource files found for method '"
                  + ownerClass.getName() + "." + name + "()'");
      }

      return computeUrl(resourceURLs, resourceClass);
View Full Code Here

Examples of com.googlecode.gwt.test.exceptions.GwtTestResourcesException

         } else {
            Object result = callback.call(method, args);
            if (result != null) {
               return result;
            } else {
               throw new GwtTestResourcesException("Not managed method '" + method.getName()
                        + "' for generated '" + proxiedClass.getName() + "' proxy");
            }
         }
      }
View Full Code Here

Examples of com.googlecode.gwt.test.exceptions.GwtTestResourcesException

            }
         }

         if (existingFiles.isEmpty()) {
            throw new GwtTestResourcesException("No resource file found for method '"
                     + ctClass.getName() + "." + method.getName() + "()'");
         }

         return existingFiles;
View Full Code Here

Examples of com.googlecode.gwt.test.exceptions.GwtTestResourcesException

      private String[] getResourceDefaultExtensions(Method method) {
         DefaultExtensions annotation = method.getReturnType().getAnnotation(
                  DefaultExtensions.class);
         if (annotation == null) {
            throw new GwtTestResourcesException(
                     method.getReturnType().getSimpleName()
                              + " does not define a default extension for resource file. You should use a correct @"
                              + Source.class.getSimpleName() + " annotation on "
                              + method.getDeclaringClass().getSimpleName() + "." + method.getName()
                              + "() method");
View Full Code Here

Examples of com.googlecode.gwt.test.exceptions.GwtTestResourcesException

         public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
            if (method.getReturnType() == AbstractImagePrototype.class) {
               String url = getImageUrl(method);
               return new ClippedImagePrototype(url, 0, 0, 0, 0);
            }
            throw new GwtTestResourcesException("Not managed return type for image bundle : "
                     + method.getReturnType().getSimpleName());
         }

         private String computeFileSimpleName(Method method) {
            String packagePath = method.getDeclaringClass().getPackage().getName().replaceAll(
                     "\\.", "/");

            String relativePath = packagePath + "/" + method.getName();

            for (String extension : IMAGE_DEFAULT_EXTENSIONS) {
               String possiblePath = relativePath + extension;
               if (this.getClass().getResource("/" + possiblePath) != null) {
                  return method.getName() + extension;
               }
            }

            // should never happened
            throw new GwtTestResourcesException("Cannot find an image with path relative to '"
                     + relativePath + "'");
         }

         private String getImageUrl(Method method) {
            String fileName;
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.