Package com.consol.citrus.admin.exception

Examples of com.consol.citrus.admin.exception.CitrusAdminRuntimeException


                projectInfo = (JSONObject) parser.parse(new FileReader(getProjectInfoFile()));
            } else {
                projectInfo = createProjectInfo();
            }
        } catch (IOException e) {
            throw new CitrusAdminRuntimeException("Could not read Citrus project information file", e);
        } catch (ParseException e) {
            throw new CitrusAdminRuntimeException("Could not parse Citrus project information file", e);
        }

        name = projectInfo.get("name").toString();
        version = projectInfo.get("version").toString();
View Full Code Here


                projectInfo.put("basePackage", XPathUtils.evaluateExpression(pomDoc, "/mvn:project/mvn:groupId", nsContext, XPathConstants.STRING));
                projectInfo.put("name", XPathUtils.evaluateExpression(pomDoc, "/mvn:project/mvn:artifactId", nsContext, XPathConstants.STRING));
                projectInfo.put("version", XPathUtils.evaluateExpression(pomDoc, "/mvn:project/mvn:properties/mvn:citrus.version", nsContext, XPathConstants.STRING));
                projectInfo.put("description", XPathUtils.evaluateExpression(pomDoc, "/mvn:project/mvn:description", nsContext, XPathConstants.STRING));
            } catch (IOException e) {
                throw new CitrusAdminRuntimeException("Unable to open Maven pom.xml file", e);
            }
        } else if (isAntProject()) {
            try {
                String buildXml = FileUtils.readToString(new FileSystemResource(new File(getAntBuildFilePath())));
                SimpleNamespaceContext nsContext = new SimpleNamespaceContext();

                Document buildDoc = XMLUtils.parseMessagePayload(buildXml);
                projectInfo.put("name", XPathUtils.evaluateExpression(buildDoc, "/project/@name", nsContext, XPathConstants.STRING));
                projectInfo.put("version", XPathUtils.evaluateExpression(buildDoc, "/project/property[@name='citrus.version']/@value", nsContext, XPathConstants.STRING));
                projectInfo.put("description", XPathUtils.evaluateExpression(buildDoc, "/project/@description", nsContext, XPathConstants.STRING));
            } catch (IOException e) {
                throw new CitrusAdminRuntimeException("Unable to open ANT build.xml file", e);
            }
        } else {
            projectInfo.put("basePackage", basePackage);
            projectInfo.put("name", name);
            projectInfo.put("version", version);
            projectInfo.put("description", description);
        }

        FileOutputStream fos = null;
        try {
            fos = new FileOutputStream(getProjectInfoFile());
            fos.write(projectInfo.toJSONString().getBytes());
            fos.flush();
        } catch (FileNotFoundException e) {
            throw new CitrusRuntimeException("Unable to open project info file", e);
        } catch (IOException e) {
            throw new CitrusAdminRuntimeException("Unable to write project info file", e);
        } finally {
            if (fos != null) {
                try {
                    fos.close();
                } catch (IOException e) {
View Full Code Here

            if (runConfiguration.getId().equals(id)) {
                return runConfiguration;
            }
        }

        throw new CitrusAdminRuntimeException("Unknown run configuration: " + id);
    }
View Full Code Here

TOP

Related Classes of com.consol.citrus.admin.exception.CitrusAdminRuntimeException

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.