Search in sources :

Example 1 with GwtTestConfigurationException

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

the class ModuleData method parseModule.

private void parseModule(String moduleName) {
    try {
        Document document = createDocument(moduleName);
        XPath xpath = XPathFactory.newInstance().newXPath();
        parseModuleFile(moduleName, document, xpath);
        alias = getModuleAlias(document, xpath);
    } catch (Exception e) {
        if (GwtTestException.class.isInstance(e)) {
            throw (GwtTestException) e;
        } else {
            throw new GwtTestConfigurationException("Error while parsing GWT module '" + moduleName + "'", e);
        }
    }
}
Also used : XPath(javax.xml.xpath.XPath) GwtTestException(com.googlecode.gwt.test.exceptions.GwtTestException) GwtTestConfigurationException(com.googlecode.gwt.test.exceptions.GwtTestConfigurationException) Document(org.w3c.dom.Document) XPathExpressionException(javax.xml.xpath.XPathExpressionException) GwtTestException(com.googlecode.gwt.test.exceptions.GwtTestException) FileNotFoundException(java.io.FileNotFoundException) GwtTestConfigurationException(com.googlecode.gwt.test.exceptions.GwtTestConfigurationException)

Example 2 with GwtTestConfigurationException

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

the class DeferredGenerateWithCreateHandler method initCustomGeneratedClasses.

private Set<Class<?>> initCustomGeneratedClasses() {
    Set<Class<?>> result = new HashSet<Class<?>>();
    String moduleName = GwtConfig.get().getTestedModuleName();
    for (String className : ModuleData.get(moduleName).getCustomGeneratedClasses()) {
        try {
            result.add(GwtReflectionUtils.getClass(className));
        } catch (ClassNotFoundException e) {
            throw new GwtTestConfigurationException("Cannot find class configured to be instanced with a custom 'generate-with' Generator : '" + className + "'");
        }
    }
    return result;
}
Also used : GwtTestConfigurationException(com.googlecode.gwt.test.exceptions.GwtTestConfigurationException) HashSet(java.util.HashSet)

Example 3 with GwtTestConfigurationException

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

the class ConfigurationLoader method readFiles.

private void readFiles() {
    try {
        Enumeration<URL> configFiles = Thread.currentThread().getContextClassLoader().getResources(CONFIG_FILENAME);
        while (configFiles.hasMoreElements()) {
            URL url = configFiles.nextElement();
            LOGGER.debug("Load config file " + url.toString());
            Properties p = new Properties();
            InputStream inputStream = url.openStream();
            p.load(inputStream);
            inputStream.close();
            process(p, url);
            LOGGER.debug("File loaded and processed " + url.toString());
        }
        if (gwtModules.size() == 0) {
            throw new GwtTestConfigurationException("No declared module. Did you forget to add your own META-INF/gwt-test-utils.properties file with a 'gwt-module' property in the test classpath?");
        }
    } catch (IOException e) {
        throw new GwtTestConfigurationException("Error while reading '" + CONFIG_FILENAME + "' files", e);
    }
}
Also used : InputStream(java.io.InputStream) GwtTestConfigurationException(com.googlecode.gwt.test.exceptions.GwtTestConfigurationException) IOException(java.io.IOException) URL(java.net.URL)

Example 4 with GwtTestConfigurationException

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

the class ConfigurationLoader method process.

private void process(Properties p, URL url) {
    for (Entry<Object, Object> entry : p.entrySet()) {
        String key = ((String) entry.getKey()).trim();
        String value = ((String) entry.getValue()).trim();
        if ("gwt-module".equals(value)) {
            gwtModules.add(key);
        } else if ("scan-package".equals(value)) {
            scanPackages.add(key);
        } else if ("delegate".equals(value)) {
            delegates.add(key);
        } else if ("src-directory".equals(value)) {
            processSrcDirectory(key);
        } else {
            throw new GwtTestConfigurationException("Error in '" + url.getPath() + "' : unknown value '" + value + "'");
        }
    }
}
Also used : GwtTestConfigurationException(com.googlecode.gwt.test.exceptions.GwtTestConfigurationException)

Example 5 with GwtTestConfigurationException

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

the class GeneratorCreateHandler method createModuleSpaceHost.

private ModuleSpaceHost createModuleSpaceHost(CompilationState compilationState, ModuleDef moduleDef) {
    try {
        ModuleSpaceHost moduleSpaceHost = new GwtTestModuleSpaceHost(GwtTreeLogger.get(), compilationState, moduleDef, null, ARTIFACT_ACCEPTOR, REBIND_CACHE);
        ModuleSpace moduleSpace = createModuleSpace(moduleSpaceHost);
        moduleSpaceHost.onModuleReady(moduleSpace);
        return moduleSpaceHost;
    } catch (UnableToCompleteException e) {
        throw new GwtTestConfigurationException("Error while creating global ModuleSpaceHost :", e);
    }
}
Also used : UnableToCompleteException(com.google.gwt.core.ext.UnableToCompleteException) 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