Package com.qspin.qtaste.testsuite

Examples of com.qspin.qtaste.testsuite.QTasteDataException


                    // Read a line of text from the user.
                    input = stdin.readLine();
                }
                hash.put(key, input);
                if (input == null) {
                    throw new QTasteDataException(key + " input value entry cancelled by user");
                // fill hashFiles if necessary
                }
                loadFileIfAny();
            }
            else
                input = hash.get(key);
           
            return input;
        } catch (Exception ex) {
            logger.error(ex);
            throw new QTasteDataException(key + " input value invalid");
        }
    }
View Full Code Here


            }

            try {
                Thread.sleep(checkTimeInterval_ms);
            } catch (InterruptedException e) {
                throw new QTasteDataException("Sleep has been interrupted while checking " + component + " property");
            }
        } while (true);

        if (possibleNotificationLoss) {
            throw new QTasteTestFailException(component + " property value cannot be checked because of a possible notification loss!");
View Full Code Here

        long beginTime_ms = System.currentTimeMillis();
        long maxTime_ms = Math.round(maxTime * 1000);
        propertyValueOrTransition = propertyValueOrTransition.toLowerCase();
        String[] splitted = propertyValueOrTransition.split(" *: *");
        if (splitted.length != 2) {
            throw new QTasteDataException("Invalid syntax");
        }
        String property = splitted[0];
        if (property.length() == 0) {
            throw new QTasteDataException("Invalid syntax");
        }
        String transition = splitted[1];
        boolean mustBeAtBegin = transition.matches("^\\[.*");
        if (mustBeAtBegin) {
            transition = transition.replaceFirst("^\\[ *", "");
        }
        boolean mustBeAtEnd = transition.matches(".*\\]$");
        if (mustBeAtEnd) {
            transition = transition.replaceFirst(" *\\]$", "");
        }
        String[] values = transition.split(" *-> *");
        if ((values.length != 1) && (values.length != 2)) {
            throw new QTasteDataException("Invalid syntax");
        }
        String expectedValueOrTransition = propertyValueOrTransition.replaceFirst(".*: *", "");

        long remainingTime_ms = maxTime_ms - (System.currentTimeMillis() - beginTime_ms);
        checkPropertyValueOrTransition(property, values, mustBeAtBegin, mustBeAtEnd, remainingTime_ms, expectedValueOrTransition);
View Full Code Here

                        arguments[i] = tempTestData.getBooleanValue(tempDataName);
                    } else if (parameterClass == DoubleWithPrecision.class) {
                        arguments[i] = tempTestData.getDoubleWithPrecisionValue(tempDataName);
                    } else {
                        logger.error("Unsupported method argument type " + parameterClass.getName());
                        throw new QTasteDataException("Invalid argument used for method " + method.getName() + " with parameter:" + argument.toString());
                    }
                }
            }
        } else {
            logger.error("parametersClasses.length < arguments.length");
            throw new QTasteDataException("Invalid number of arguments for method " + method.getName());
        }
        return arguments;
    }
View Full Code Here

    public void throwQTasteTestFailException() throws QTasteTestFailException {
        throw new QTasteTestFailException("This verb always fails!");
    }

    public void throwQTasteDataException() throws QTasteDataException {
        throw new QTasteDataException("Invalid data");
    }
View Full Code Here

        if (!hash.containsKey(key)) {
            if (key.equals("INSTANCE_ID")) {
                try {
                    return TestBedConfiguration.getInstance().getDefaultInstanceId();
                } catch (NoSuchElementException ex) {
                    throw new QTasteDataException("Default instance_id is not defined in TestBed configuration!");
                } catch (ConversionException ex) {
                    throw new QTasteDataException("Default instance_id is not valid in TestBed configuration!");
                }
            } else {
                throw new QTasteDataException("TestData doesn't contain value for data " + key);
            }
        }

        String value = hash.get(key);
        if (key.startsWith("FILE_")) {
View Full Code Here

    public int getIntValue(String key) throws QTasteDataException {
        try {
            return Integer.parseInt(getValue(key));
        } catch (NumberFormatException e) {
            throw new QTasteDataException(e.toString() + " while parsing integer data " + key, e);
        }
    }
View Full Code Here

    public double getDoubleValue(String key) throws QTasteDataException {
        try {
            return Double.parseDouble(getValue(key));
        } catch (NumberFormatException e) {
            throw new QTasteDataException(e.toString() + " while parsing double data " + key, e);
        }
    }
View Full Code Here

                    return false;
                }
            } catch (NumberFormatException e) {
            }

            throw new QTasteDataException("Error while parsing boolean data " + key + " for input string: \"" + value + "\"");
        }
    }
View Full Code Here

    public DoubleWithPrecision getDoubleWithPrecisionValue(String key) throws QTasteDataException {
        String value = getValue(key);
        try {
            return new DoubleWithPrecision(value);
        } catch (NumberFormatException e) {
            throw new QTasteDataException("Error while parsing DoubleWithPrecision data " + key + " for input string: \"" + value + "\"", e);
        }
    }
View Full Code Here

TOP

Related Classes of com.qspin.qtaste.testsuite.QTasteDataException

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.