Package com.sun.faban.driver

Examples of com.sun.faban.driver.DefinitionException


    public void validate() throws DefinitionException {
        if (mix.length != operations.length) {
            String msg = "Mix ratios must be " + operations.length +
                    "(#ops) in size!\nFound " + mix.length + ".";
            getLogger().severe(msg);
            DefinitionException e = new DefinitionException(msg);
            getLogger().throwing(className, "validate", e);
            throw e;
        }
    }
View Full Code Here


                // It is the responsibility of the corresponding facility to
                // pick it up.
                continue;
            }
            if (classCycle != null) {
        throw new DefinitionException("Duplicate class cycle " +
                        "annotation @" + annotationName);
      }
            cycle.init(annotations[i]);
            classCycle = cycle;
        }

        // Now we make the same set of tests at the operation level
        for (BenchmarkDefinition.Operation o : operations) {

            annotations = o.m.getAnnotations();
            for (int i = 0; i < annotations.length; i++) {
                String typeName = annotations[i].annotationType().getName();
                int cnBegin = typeName.lastIndexOf('.');
                ++cnBegin;
                String annotationName = typeName.substring(cnBegin);
                String pkgName = typeName.substring(0, cnBegin);
                String cycleName = pkgName + "engine." + annotationName;
                Cycle cycle = null;
                try {
                    cycle = Class.forName(cycleName).
                            asSubclass(Cycle.class).newInstance();
                } catch (Exception e) {
                    // If the annotation is not a cycle, we just ignore it here.
                    // It is the responsibility of the corresponding facility to
                    // pick it up.
                    continue;
                }
                if (o.cycle != null) {
          throw new DefinitionException("Duplicate operation cycle " +
                            "annotation for operation " +
                            o.name + " @" + annotationName);
        }
                cycle.init(annotations[i]);
                o.cycle = cycle;
            }

            // Finally, we need to test for no cycle at all and handle the case
            if (o.cycle == null) {
        o.cycle = classCycle;
      }

            if (o.cycle == null) {
        throw new DefinitionException("No cycle distribution " +
                        "annotation for operation " + o.name);
      }
        }
    }
View Full Code Here

      cycleMax = 5 * cycleMean;
    }

        // Now check parameters for validity.
        if (cycleMin < 0) {
      throw new DefinitionException("@NegativeExponential cycleMin < 0");
    }
        if (cycleMean < 0) {
      throw new DefinitionException("@NegativeExponential cycleMean < 0");
    }
        if (cycleMax < 0) {
      throw new DefinitionException("@NegativeExponential cycleMax < 0");
    }
        if (cycleMin > cycleMean) {
      throw new DefinitionException(
                    "@NegativeExponential cycleMin > cycleMean");
    }
        if (cycleMean > cycleMax) {
      throw new DefinitionException(
                    "@NegativeExponential cycleMean > cycleMax");
    }
        if (cycleMax == 0 && cycleType == CycleType.CYCLETIME) {
      throw new DefinitionException(
                    "@NegativeExponential CYCLETIME cycleMax cannot be 0");
    }
        // Adjust time to nanosec.
        cycleMin  *= Utilities.TO_NANOS;
        cycleMean *= Utilities.TO_NANOS;
View Full Code Here

        cycleDeviation = cycleDef.cycleDeviation();
        cycleTime = cycleDef.cycleTime() * Utilities.TO_NANOS;

        // Now check parameters for validity.
        if (cycleTime == 0 && cycleType == CycleType.CYCLETIME) {
      throw new DefinitionException("@FixedTime cycle time " +
                    "cannot be 0, use think time instead.");
    }

    }
View Full Code Here

        cycleMin = cycleDef.cycleMin();
        cycleMax = cycleDef.cycleMax();
       
        // Now check parameters for validity.
        if (cycleMin < 0) {
      throw new DefinitionException("@Uniform cycleMin < 0");
    }
        if (cycleMax < 0) {
      throw new DefinitionException("@Uniform cycleMax < 0");
    }
        if (cycleMin > cycleMax) {
      throw new DefinitionException("@Uniform cycleMin > cycleMax");
    }
        if (cycleMax == 0 && cycleType == CycleType.CYCLETIME) {
      throw new DefinitionException(
                    "@Uniform CYCLETIME cycleMax cannot be 0");
    }
        // Adjust time to nanosec.
        cycleMin *= Utilities.TO_NANOS;
        cycleMax *= Utilities.TO_NANOS;
View Full Code Here

                // It is the responsibility of the corresponding facility to
                // pick it up.
                continue;
            }
            if (returnMix != null) {
        throw new DefinitionException("Duplicate mix annotation @" +
                        annotationName);
      }
            mix.init(driverClass, annotations[i]);
            returnMix = mix;
        }
View Full Code Here

        if (mix.length != operations.length) {
            String msg = "Mix matrix must be " + operations.length + " x " +
                    operations.length + " (#ops x #ops) in size!\nFound " +
                    mix.length + " x " + mix[0].length + ".";
            getLogger().severe(msg);
            DefinitionException e = new DefinitionException(msg);
            getLogger().throwing(className, "validate", e);
            throw e;
        }
        for (int i = 0; i < operations.length; i++) {
      if (mix[i].length != operations.length) {
                String msg = "All rows in mix matrix must be " +
                        operations.length + " (#ops) in size.\nFound row " +
                        i + " to be of size " + mix[i].length + ".";
                getLogger().severe(msg);
                DefinitionException e = new DefinitionException(msg);
                getLogger().throwing(className, "validate", e);
                throw e;
            }
    }
    }
View Full Code Here

TOP

Related Classes of com.sun.faban.driver.DefinitionException

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.