all: interlinked and completed JUnit testcases
authorwneuper
Mon, 27 Jun 2005 18:12:55 +0200
changeset 254362acf19daa74
parent 2542 c8eb75c725c6
child 2544 631fe7f467b7
all: interlinked and completed JUnit testcases
src/java/isac/bridge/BridgeRMI.java
src/java/isac/kestore/KEStoreServices.java
src/java/isac/util/CalcChanged.java
src/java/isac/util/interfaces/IToCalc.java
src/java/isac/util/parser/FormalizationDigest.java
     1.1 --- a/src/java/isac/bridge/BridgeRMI.java	Mon Jun 27 18:12:55 2005 +0200
     1.2 +++ b/src/java/isac/bridge/BridgeRMI.java	Mon Jun 27 18:12:55 2005 +0200
     1.3 @@ -310,6 +310,9 @@
     1.4       * activeCalcHead for completeness return true; }
     1.5       */
     1.6  
     1.7 +    /**
     1.8 +     * @deprecated
     1.9 +     */
    1.10      public void completeCalcHead(int id, CalcHead calcHead, int completeItem) {
    1.11          ResponseWrapper wrapper = interpretSML(calcHead.getCalcTreeID(),
    1.12                  "autoCalculate @calcid@ CompleteCalcHead;", false);
    1.13 @@ -318,21 +321,20 @@
    1.14          //return result; WN040924 miniupdate
    1.15      }
    1.16  
    1.17 +    /**
    1.18 +     * FIXXME.WN05 completeCalcHead MUST return CalcChanged !
    1.19 +     */
    1.20      public void completeCalcHead(int id) {
    1.21          logger_.warn("begin completeCalcHead");
    1.22          ResponseWrapper wrapper = interpretSML(id, //calc_head_.getCalcTreeID(),
    1.23                  "autoCalculate @calcid@ CompleteCalcHead;", false);
    1.24 -        //WN041208 ---vvv
    1.25 -        //ResponseWrapper w = interpretSML(id, "getActiveFormula @calcid@ ;",
    1.26 -        // false);
    1.27 -        //Position p = (Position) w.getResponse();
    1.28 -        //wrapper = interpretSML(id, "refFormula @calcid@ " + p.toSMLString()
    1.29 -        // +";", false);
    1.30 -        //WN041208 ---^^^---------------------------------for ^^^^^^^^^^^^^^^
    1.31 -        //wrapper = interpretSML(id, "refFormula @calcid@ 1;", false);
    1.32 -        //CalcHead result = (CalcHead) wrapper.getResponse();
    1.33 -        //result.setCalcTreeID(smlCalcIDtoJavaCalcID(wrapper.getCalcID()));
    1.34 -        //return result; WN040924 miniupdate
    1.35 +        //return CalcChanged !!!
    1.36 +        //        if (wrapper == null)
    1.37 +        //            return null;
    1.38 +        //        else if (wrapper.getResponse() instanceof Message)
    1.39 +        //            return null;//TODO.WN041209 handle messages
    1.40 +        //        else
    1.41 +        //            return (CalcChanged) wrapper.getResponse();
    1.42      }
    1.43  
    1.44      public int setNextTactic(int id, Tactic tactic) {
    1.45 @@ -368,11 +370,15 @@
    1.46          if ((scope == 3) && (nSteps == 0)) {
    1.47              wrapper = interpretSML(id,
    1.48                      "autoCalculate @calcid@ CompleteCalcHead;", false);
    1.49 -            //FIXXXME040624 nSteps == 0 hides mismatch in specifications
    1.50 +            //FIXXXME.WN040624 nSteps == 0 hides mismatch in specifications
    1.51          } else if ((scope == IToCalc.SCOPE_CALCULATION) && (nSteps == 0)) {
    1.52              wrapper = interpretSML(id, "autoCalculate @calcid@ CompleteCalc;",
    1.53                      false);
    1.54  
    1.55 +        } else if ((scope == IToCalc.SCOPE_MODEL) && (nSteps == 0)) {
    1.56 +            wrapper = interpretSML(id, "autoCalculate @calcid@ CompleteModel;",
    1.57 +                    false);
    1.58 +
    1.59          } else if ((scope == IToCalc.SCOPE_SUBCALCULATION) && (nSteps == 0)) {
    1.60              wrapper = interpretSML(id,
    1.61                      "autoCalculate @calcid@ CompleteToSubpbl;", false);
     2.1 --- a/src/java/isac/kestore/KEStoreServices.java	Mon Jun 27 18:12:55 2005 +0200
     2.2 +++ b/src/java/isac/kestore/KEStoreServices.java	Mon Jun 27 18:12:55 2005 +0200
     2.3 @@ -60,7 +60,7 @@
     2.4              else if (type.equals("met"))
     2.5                  document = db.parse(path_ + "/met/met_hierarchy.xml");
     2.6              else if (type.equals("exp"))
     2.7 -                    document = db.parse(path_ + "/exp/exp__hierarchy.xml");
     2.8 +                document = db.parse(path_ + "/exp/exp__hierarchy.xml");
     2.9  
    2.10              DOMSource source = new DOMSource(document);
    2.11              StringWriter output = new StringWriter();
    2.12 @@ -132,7 +132,7 @@
    2.13                  String id_part = (String) id.remove(0);
    2.14                  for (int i = 0; i < childlist.getLength(); i++) {
    2.15                      if (!childlist.item(i).getNodeName().trim().equals("NODE"))
    2.16 -                            continue;
    2.17 +                        continue;
    2.18                      if (childlist.item(i).getChildNodes().item(1)
    2.19                              .getFirstChild().getNodeValue().trim().equals(
    2.20                                      id_part)) {
    2.21 @@ -143,7 +143,8 @@
    2.22                  }
    2.23              }
    2.24  
    2.25 -            if (!found) return new Vector();
    2.26 +            if (!found)
    2.27 +                return new Vector();
    2.28  
    2.29              String filename = "";
    2.30              if (pblnode instanceof Element) {
    2.31 @@ -176,12 +177,13 @@
    2.32       * data-format is not found yet.
    2.33       * 
    2.34       * @param type
    2.35 -     *            of the KE-Object (like a collection)
    2.36 +     *            of the KE-Object (like a collection) ::= "exp" | "pbl" | "met"
    2.37       * @param file
    2.38       *            id of the KE-Object to load (filename in the current
    2.39       *            implementation)
    2.40       * @return Vector with the KE-Object in its XML-representation in its first
    2.41 -     *         element or empty Vector if the file was not found.
    2.42 +     *         element or empty Vector if the file was not found or if 'parse'
    2.43 +     *         failed
    2.44       */
    2.45      public Vector loadContent(String type, String file) {
    2.46          System.out.println("File:" + file);
    2.47 @@ -190,6 +192,9 @@
    2.48              DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
    2.49              DocumentBuilder db = dbf.newDocumentBuilder();
    2.50              Document document = db.parse(path_ + "/" + type + "/" + file);
    2.51 +            //TODO.AG? here .......^^^^^ the content MUST be encoded,
    2.52 +            // e.g. "&" as &lt;" .. can this be done by calling something like
    2.53 +            // FormalizationDigest#encodeEntities ???
    2.54              DOMSource source = new DOMSource(document);
    2.55              StringWriter output = new StringWriter();
    2.56              StreamResult result = new StreamResult(output);
    2.57 @@ -198,7 +203,7 @@
    2.58              transformer.transform(source, result);
    2.59  
    2.60              return_value.add(output.toString()); //WN040830 why Vector for 1
    2.61 -            // element ?
    2.62 +            // element ? AG: (very early) design decision for later expansion
    2.63          } catch (Exception exc) {
    2.64              System.out.println("KEStore:Exception " + exc.getMessage());
    2.65          }
     3.1 --- a/src/java/isac/util/CalcChanged.java	Mon Jun 27 18:12:55 2005 +0200
     3.2 +++ b/src/java/isac/util/CalcChanged.java	Mon Jun 27 18:12:55 2005 +0200
     3.3 @@ -13,9 +13,10 @@
     3.4  
     3.5  /**
     3.6   * Contains the 3 iterators which describe the changes in a CalcTree caused by
     3.7 - * one step (a Tactic or an input Formula). Needed for reference by
     3.8 + * one step (a Tactic or an input Formula).
     3.9   * 
    3.10 - * @see isac.util.parser.XMLParserDigest
    3.11 + * LK?AK? include Message here ? allow (a)Message AND (b)iterators in parallel ??
    3.12 + * one of (a)|(b)=null would mean: nothing happened; both =null impossible
    3.13   * 
    3.14   * @author Walther Neuper Nov 4, 2004, 6:15:04 PM
    3.15   * @version 1.0
     4.1 --- a/src/java/isac/util/interfaces/IToCalc.java	Mon Jun 27 18:12:55 2005 +0200
     4.2 +++ b/src/java/isac/util/interfaces/IToCalc.java	Mon Jun 27 18:12:55 2005 +0200
     4.3 @@ -114,7 +114,6 @@
     4.4       * @param completeItem
     4.5       *            the item which should be added TODO: return int like
     4.6       *            replaceFormula etc.
     4.7 -     * 
     4.8       * WN040916 don't confuse with autCalculate(...CompleteCalcHead) WN0504 this
     4.9       * case is notyet designed: how indicate the field ???
    4.10       */
    4.11 @@ -222,7 +221,16 @@
    4.12       * 
    4.13       * @see #autoCalculate(int, int)
    4.14       */
    4.15 -    public static final int SCOPE_CALCULATION = 6;
    4.16 +    public static final int SCOPE_CALCULATION = 7;
    4.17 +
    4.18 +    /**
    4.19 +     * Do the number of steps requested, without any restrictions. autoCalculate
    4.20 +     * ... CompleteModel Do NOT change the value of this constant, as this number
    4.21 +     * has a specifig meaning in other parts of the system!
    4.22 +     * 
    4.23 +     * @see #autoCalculate(int, int)
    4.24 +     */
    4.25 +    public static final int SCOPE_MODEL = 6;
    4.26  
    4.27      /**
    4.28       * Do the number of steps requested, but do not leave the current
     5.1 --- a/src/java/isac/util/parser/FormalizationDigest.java	Mon Jun 27 18:12:55 2005 +0200
     5.2 +++ b/src/java/isac/util/parser/FormalizationDigest.java	Mon Jun 27 18:12:55 2005 +0200
     5.3 @@ -314,7 +314,7 @@
     5.4              e.printStackTrace();
     5.5          }
     5.6          ResponseWrapper wrapper = (ResponseWrapper) o;
     5.7 -        //System.out.println(wrapper.getCalcID().toSMLString());
     5.8 +        //System.out.println("calcID = "+wrapper.getCalcID());
     5.9          return wrapper;
    5.10      }
    5.11