Search in sources :

Example 11 with GwtTestConfigurationException

use of com.googlecode.gwt.test.exceptions.GwtTestConfigurationException in project gwt-test-utils by gwt-test-utils.

the class GwtGuiceHelper method getInjector.

public Injector getInjector() {
    if (this.injector == null && !hasSearchedInjector) {
        for (String listenerClassName : WebXmlUtils.get().getListenerClasses()) {
            try {
                Class<?> clazz = GwtReflectionUtils.getClass(listenerClassName);
                if (GuiceServletContextListener.class.isAssignableFrom(clazz)) {
                    Object instance = GwtReflectionUtils.instantiateClass(clazz);
                    this.injector = GwtReflectionUtils.callPrivateMethod(instance, "getInjector");
                }
            } catch (Exception e) {
                throw new GwtTestConfigurationException("Error while parsing web.xml searching for a Guice Injector in a configured GuiceServletContextListener", e);
            }
        }
        hasSearchedInjector = true;
    }
    // can be null
    return this.injector;
}
Also used : GwtTestConfigurationException(com.googlecode.gwt.test.exceptions.GwtTestConfigurationException) GwtTestConfigurationException(com.googlecode.gwt.test.exceptions.GwtTestConfigurationException)

Aggregations

GwtTestConfigurationException (com.googlecode.gwt.test.exceptions.GwtTestConfigurationException)11 UnableToCompleteException (com.google.gwt.core.ext.UnableToCompleteException)1 RemoteService (com.google.gwt.user.client.rpc.RemoteService)1 GwtModule (com.googlecode.gwt.test.GwtModule)1 GwtTestException (com.googlecode.gwt.test.exceptions.GwtTestException)1 JavaScriptObjects (com.googlecode.gwt.test.utils.JavaScriptObjects)1 FileNotFoundException (java.io.FileNotFoundException)1 IOException (java.io.IOException)1 InputStream (java.io.InputStream)1 URL (java.net.URL)1 HashSet (java.util.HashSet)1 XPath (javax.xml.xpath.XPath)1 XPathExpressionException (javax.xml.xpath.XPathExpressionException)1 Document (org.w3c.dom.Document)1 XMLReader (org.xml.sax.XMLReader)1