1package com.mot.treetest; 2 3public class Validator { 4 Util u = new Util(); 5 6 public Content validateLeafAccess(Node n) throws Exception { 7 //For the future development: command + path + value + lineCount + retCode 8 String command = ""; 9 int count = 0; 10 String suffix = u.getTypeSuffixForCommand(n); 11 String testVal = u.getTestValue(n); 12 Access a = u.getAccess(n); 13 // Get, Replace, Delete, Add 14 // start from the bottom "Add". check that we can delete it before 15 if (a.add == 1 && a.delete == 1) { 16 //command = "createl" + suffix + " " + n.path + " " + testVal + count + " 0\n"; 17 command = "createl" + suffix + " " + n.path + " " + testVal + "\n"; 18 //count++; 19 } 20 // Next from the bottom "Delete" 21 if (a.delete == 1) { 22 command = "delete " + n.path + "\n" + command; 23 //count++; 24 } 25 // Next from the bottom "Replace" 26 if (a.replace == 1) { 27 //command = "set" + suffix + " " + n.path + " " + testVal + count + " 0\n"; 28 command = "set" + suffix + " " + n.path + " " + testVal + "\n" + command; 29 //count++; 30 } 31 // Next from the bottom "Get" 32 if (a.get == 1) { 33 command = "get " + n.path + "\n" + command; 34 //count++; 35 } 36 37 Content c = new Content(); 38 c.tests = command; 39 c.lines = count; 40 41 return c; 42 } 43 44 public Content validateInteriorAccess(Node n) { 45 //For the future development: command + path + value + lineCount + retCode 46 String command = ""; 47 int count = 0; 48 49 command = "get " + n.path + "\n"; 50 count++; 51 52 Content c = new Content(); 53 c.tests = command; 54 c.lines = count; 55 56 return c; 57 } 58 59} 60