diff --git a/src/main/java/myutil/FileUtils.java b/src/main/java/myutil/FileUtils.java index 063a44612a954e62e7a8a4a0565881387f2d37db..7d48e070e637d2025019d6803b3e9d06a9cd38b5 100644 --- a/src/main/java/myutil/FileUtils.java +++ b/src/main/java/myutil/FileUtils.java @@ -40,6 +40,8 @@ package myutil; import java.io.*; +import java.util.ArrayList; +import java.util.List; /** @@ -343,4 +345,100 @@ public class FileUtils extends org.apache.commons.io.FileUtils { } } + public static boolean compareTMLFiles(File expected, File clone) throws Exception { + + BufferedReader expectedReader = new BufferedReader(new FileReader(expected)); + BufferedReader cloneReader = new BufferedReader(new FileReader(clone)); + + String expectedString = ""; + String cloneString = ""; + String s1; + String s2; + + while ((s1 = expectedReader.readLine()) != null) { + if (!s1.contains("//") && s1.length() > 0) { + s1 = s1.trim(); + expectedString += s1; + } + } + + while ((s2 = cloneReader.readLine()) != null){ + if (!s2.contains("//") && s2.length() > 0) { + s2 = s2.trim(); + cloneString += s2; + } + } + + String[] expectedStringArray = expectedString.split("\\s+"); + String[] cloneStringArray = cloneString.split("\\s+"); + return checkEqualityForTMLFiles(expectedStringArray, cloneStringArray); + } + + private static boolean checkEqualityForTMLFiles(String[] s1, String[] s2) { + if (s1 == s2) + return true; + + if (s1 == null || s2 == null) + return false; + + int n = s1.length; + if (n != s2.length) + return false; + + for (int i = 0; i < n; i++) { + if (!s1[i].equals(s2[i])) + return false; + } + + return true; + } + + public static boolean CompareTMAPFiles(File expected, File clone) throws Exception { + + BufferedReader expectedReader = new BufferedReader(new FileReader(expected)); + BufferedReader cloneReader = new BufferedReader(new FileReader(clone)); + + String s1; + String s2; + List<String> expectedStringArray = new ArrayList<String>(); + List<String> cloneStringArray = new ArrayList<String>(); + + while ((s1 = expectedReader.readLine()) != null) { + if (s1.indexOf("//") >= 0) { + s1 = s1.substring(0, s1.indexOf("//")); + } + if (!s1.contains("#include") && s1.length() > 0) { + s1 = s1.trim(); + expectedStringArray.add(s1); + } + } + + while ((s2 = cloneReader.readLine()) != null){ + if (s2.indexOf("//") >= 0) { + s2 = s2.substring(0, s2.indexOf("//")); + } + if (!s2.contains("#include") && s2.length() > 0) { + s2 = s2.trim(); + cloneStringArray.add(s2); + } + } + expectedReader.close(); + cloneReader.close(); + + return checkEqualityForTMAPFiles(expectedStringArray, cloneStringArray); + } + + private static boolean checkEqualityForTMAPFiles(List<String> s1, List<String> s2) { + for (String s : s1) { + if (s2.contains(s)) { + s2.remove(s); + } + } + + if (s2.size() == 0) { + return true; + } + + return false; + } } // Class diff --git a/src/main/java/tmltranslator/HwA.java b/src/main/java/tmltranslator/HwA.java index 963517c6df6bf23998069ac5ed600020c37757d0..e20c2cb0eb7a07b77466d7c6ecad7f28f5af4410 100755 --- a/src/main/java/tmltranslator/HwA.java +++ b/src/main/java/tmltranslator/HwA.java @@ -41,8 +41,6 @@ package tmltranslator; -import java.util.Objects; - /** * Class HwA * Creation: 23/11/2007 @@ -79,9 +77,9 @@ public class HwA extends HwExecutionNode { return s; } - public boolean equalSpec(Object o) { + public boolean equalsSpec(Object o) { if (!(o instanceof HwA)) return false; - if (!super.equalSpec(o)) return false; + if (!super.equalsSpec(o)) return false; HwA hwA = (HwA) o; return byteDataSize == hwA.byteDataSize; } diff --git a/src/main/java/tmltranslator/HwBridge.java b/src/main/java/tmltranslator/HwBridge.java index def07d9b05f75c23064a17d7310a9bce2c9de35b..05a6ad8ba0fe088238f9b6acd67123751c64ed9e 100755 --- a/src/main/java/tmltranslator/HwBridge.java +++ b/src/main/java/tmltranslator/HwBridge.java @@ -43,9 +43,7 @@ package tmltranslator; import java.util.ArrayList; import java.util.List; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Objects; +import java.util.HashSet; /** * Class HwBridge @@ -72,9 +70,9 @@ public class HwBridge extends HwCommunicationNode { return s; } - public boolean equalSpec(Object o) { + public boolean equalsSpec(Object o) { if (!(o instanceof HwBridge)) return false; - if (!super.equalSpec(o)) return false; + if (!super.equalsSpec(o)) return false; HwBridge hwBridge = (HwBridge) o; return latency == hwBridge.latency && bufferByteSize == hwBridge.bufferByteSize && diff --git a/src/main/java/tmltranslator/HwBus.java b/src/main/java/tmltranslator/HwBus.java index 56ba2dd6e5b568ca93cd0a695dc1cc0f059b3cae..b5e073a221124787457d35fca812a02b2491e4f2 100755 --- a/src/main/java/tmltranslator/HwBus.java +++ b/src/main/java/tmltranslator/HwBus.java @@ -39,10 +39,6 @@ package tmltranslator; -import myutil.TraceManager; - -import java.util.Objects; - /** * Class HwBus * Creation: 05/09/2007 @@ -82,10 +78,10 @@ public class HwBus extends HwCommunicationNode { return s; } - public boolean equalSpec(Object o) { + public boolean equalsSpec(Object o) { if (!(o instanceof HwBus)) return false; - if (!super.equalSpec(o)) return false; + if (!super.equalsSpec(o)) return false; HwBus hwBus = (HwBus) o; //TraceManager.addDev("Testing equality in HwBus for " + toXML() + " and " + toXML()); diff --git a/src/main/java/tmltranslator/HwCPU.java b/src/main/java/tmltranslator/HwCPU.java index aa1baf76a52fdfded835c49d931107c49318576f..6368f1316bbb87b8d088a950f10bd2741f4bd799 100755 --- a/src/main/java/tmltranslator/HwCPU.java +++ b/src/main/java/tmltranslator/HwCPU.java @@ -124,9 +124,9 @@ public class HwCPU extends HwExecutionNode { return s; } - public boolean equalSpec(Object o) { + public boolean equalsSpec(Object o) { if (!(o instanceof HwCPU)) return false; - if (!super.equalSpec(o)) return false; + if (!super.equalsSpec(o)) return false; HwCPU hwCPU = (HwCPU) o; return encryption == hwCPU.encryption && nbOfCores == hwCPU.nbOfCores && @@ -139,7 +139,7 @@ public class HwCPU extends HwExecutionNode { cacheMiss == hwCPU.cacheMiss && schedulingPolicy == hwCPU.schedulingPolicy && sliceTime == hwCPU.sliceTime && - MEC.equalSpec(hwCPU.MEC); + MEC.equalsSpec(hwCPU.MEC); } public HwCPU deepClone(TMLArchitecture _archi) throws TMLCheckingError { diff --git a/src/main/java/tmltranslator/HwCommunicationNode.java b/src/main/java/tmltranslator/HwCommunicationNode.java index 11902437c0df581b5fa0c053b7847af60527e119..e6dea749792880b123fb487d79b2e8591eea95a4 100755 --- a/src/main/java/tmltranslator/HwCommunicationNode.java +++ b/src/main/java/tmltranslator/HwCommunicationNode.java @@ -42,10 +42,6 @@ package tmltranslator; -import myutil.TraceManager; - -import java.util.Objects; - /** * Class HwCommunicationNode * Creation: 23/11/2007 @@ -66,10 +62,10 @@ public abstract class HwCommunicationNode extends HwNode { super(_name); } - public boolean equalSpec(Object o) { - //TraceManager.addDev("equalSpec in HwCommunicationNode"); + @Override + public boolean equalsSpec(Object o) { if(!(o instanceof HwCommunicationNode)) return false; - if (!super.equalSpec(o)) return false; + if (!super.equalsSpec(o)) return false; HwCommunicationNode that = (HwCommunicationNode) o; //TraceManager.addDev("Comparing HwCommunicationNode " + getName() + " with " + that.getName()); return privacy == that.privacy; diff --git a/src/main/java/tmltranslator/HwCrossbar.java b/src/main/java/tmltranslator/HwCrossbar.java index 8959660687b79182214b211273ed84e0ccaa4a39..3220d631344a6876e22a4886aeb9058b50c0f55f 100755 --- a/src/main/java/tmltranslator/HwCrossbar.java +++ b/src/main/java/tmltranslator/HwCrossbar.java @@ -64,9 +64,9 @@ public class HwCrossbar extends HwCommunicationNode { return s; } - public boolean equalSpec(Object o) { + public boolean equalsSpec(Object o) { if (!(o instanceof HwCrossbar)) return false; - if (!super.equalSpec(o)) return false; + if (!super.equalsSpec(o)) return false; HwCrossbar hwCrossbar = (HwCrossbar) o; return byteDataSize == hwCrossbar.byteDataSize; } diff --git a/src/main/java/tmltranslator/HwDMA.java b/src/main/java/tmltranslator/HwDMA.java index 162058fa217a56393ee39651056aa98ab3c36005..0cbfb60728f3b7c7c69b16482f1f8a4fdc1bee88 100755 --- a/src/main/java/tmltranslator/HwDMA.java +++ b/src/main/java/tmltranslator/HwDMA.java @@ -41,8 +41,6 @@ package tmltranslator; -import java.util.Objects; - /** * Class HwDMA * Creation: 26/09/2011 @@ -68,9 +66,9 @@ public class HwDMA extends HwCommunicationNode { } - public boolean equalSpec(Object o) { + public boolean equalsSpec(Object o) { if (!(o instanceof HwDMA)) return false; - if (!super.equalSpec(o)) return false; + if (!super.equalsSpec(o)) return false; HwDMA hwDMA = (HwDMA) o; return byteDataSize == hwDMA.byteDataSize && nbOfChannels == hwDMA.nbOfChannels; diff --git a/src/main/java/tmltranslator/HwExecutionNode.java b/src/main/java/tmltranslator/HwExecutionNode.java index 98b56d2fef9fdfefee376899902c305b6de36e7c..1c19529932fadb1f91cad41ed15a8d031e101c59 100755 --- a/src/main/java/tmltranslator/HwExecutionNode.java +++ b/src/main/java/tmltranslator/HwExecutionNode.java @@ -41,8 +41,6 @@ package tmltranslator; -import java.util.Objects; - /** * Class HwExecutionNode * Creation: 23/11/2007 @@ -99,9 +97,9 @@ public abstract class HwExecutionNode extends HwNode { return false; } - public boolean equalSpec(Object o) { + public boolean equalsSpec(Object o) { if (!(o instanceof HwExecutionNode)) return false; - if(!super.equalSpec(o)) return false; + if(!super.equalsSpec(o)) return false; HwExecutionNode that = (HwExecutionNode) o; return maximumNbOfTasks == that.maximumNbOfTasks && execiTime == that.execiTime && diff --git a/src/main/java/tmltranslator/HwFPGA.java b/src/main/java/tmltranslator/HwFPGA.java index a79337ff1be461f5a5585153f59e7970611f48da..978d53fa40123cae2f47e177abdaa7681c67b7a3 100755 --- a/src/main/java/tmltranslator/HwFPGA.java +++ b/src/main/java/tmltranslator/HwFPGA.java @@ -39,8 +39,6 @@ package tmltranslator; -import tmltranslator.modelcompiler.ArchUnitMEC; - /** * Class HwFPGA @@ -93,9 +91,9 @@ public class HwFPGA extends HwExecutionNode { return s; } - public boolean equalSpec(Object o) { + public boolean equalsSpec(Object o) { if (!(o instanceof HwFPGA)) return false; - if(!super.equalSpec(o)) return false; + if(!super.equalsSpec(o)) return false; HwFPGA hwFPGA = (HwFPGA) o; return byteDataSize == hwFPGA.byteDataSize && goIdleTime == hwFPGA.goIdleTime && diff --git a/src/main/java/tmltranslator/HwLink.java b/src/main/java/tmltranslator/HwLink.java index 8c0f828656829c30d5cad1d31ba2f5cf527265b9..dc297fae0b3ffd92b5d9fbe509b4cce19684962a 100755 --- a/src/main/java/tmltranslator/HwLink.java +++ b/src/main/java/tmltranslator/HwLink.java @@ -109,7 +109,7 @@ public class HwLink implements Comparable<HwLink> { return (nodeBus == bus) || (nodeBus == vgmn) || (nodeBus == crossbar); } - public boolean equalSpec(Object o) { + public boolean equalsSpec(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; HwLink hwLink = (HwLink) o; diff --git a/src/main/java/tmltranslator/HwMemory.java b/src/main/java/tmltranslator/HwMemory.java index a603b91cecc3491f0d73df82a6cae04a2d13e140..8f985799f0e3a26c69a4b14404ad745fafd67a7f 100755 --- a/src/main/java/tmltranslator/HwMemory.java +++ b/src/main/java/tmltranslator/HwMemory.java @@ -41,8 +41,6 @@ package tmltranslator; -import java.util.Objects; - /** * Class HwMemory * Creation: 23/11/2007 @@ -70,9 +68,9 @@ public class HwMemory extends HwCommunicationNode { return s; } - public boolean equalSpec(Object o) { + public boolean equalsSpec(Object o) { if (!(o instanceof HwMemory)) return false; - if(!super.equalSpec(o)) return false; + if(!super.equalsSpec(o)) return false; HwMemory hwMemory = (HwMemory) o; return bufferType == hwMemory.bufferType && byteDataSize == hwMemory.byteDataSize && diff --git a/src/main/java/tmltranslator/HwNoC.java b/src/main/java/tmltranslator/HwNoC.java index c96fe876c0ecda9d475aba75218aecb005dd1cf2..0a03ab7bb9f3699066f582d48cef63663f1677a5 100755 --- a/src/main/java/tmltranslator/HwNoC.java +++ b/src/main/java/tmltranslator/HwNoC.java @@ -44,7 +44,6 @@ package tmltranslator; import myutil.TraceManager; import java.awt.*; -import java.util.ArrayList; import java.util.HashMap; @@ -213,9 +212,9 @@ public class HwNoC extends HwCommunicationNode { } - public boolean equalSpec(Object o) { + public boolean equalsSpec(Object o) { if (!(o instanceof HwNoC)) return false; - if (!super.equalSpec(o)) return false; + if (!super.equalsSpec(o)) return false; HwNoC hwNoC = (HwNoC) o; if (placementMap != null) { diff --git a/src/main/java/tmltranslator/HwNode.java b/src/main/java/tmltranslator/HwNode.java index 89b0b752155e5e79c3e0f286c48b9e7405c75d34..53012662579e7c1d6d12d1294321b264c01f68b7 100755 --- a/src/main/java/tmltranslator/HwNode.java +++ b/src/main/java/tmltranslator/HwNode.java @@ -41,11 +41,8 @@ package tmltranslator; -import myutil.TraceManager; import tmltranslator.modelcompiler.ArchUnitMEC; -import java.util.Objects; - /** * Class HwNode @@ -80,12 +77,12 @@ public abstract class HwNode extends DIPLOElement { public abstract String toXML(); - public boolean equalSpec(Object o) { - TraceManager.addDev("equalSpec in HwNode"); + public boolean equalsSpec(Object o) { +// TraceManager.addDev("equalsSpec in HwNode"); if (!(o instanceof HwNode)) return false; HwNode hwNode = (HwNode) o; - if (mec != null && (!mec.equalSpec(hwNode.getArchUnitMEC()))) + if (mec != null && (!mec.equalsSpec(hwNode.getArchUnitMEC()))) return false; return maximumNbOfMappedElement == hwNode.maximumNbOfMappedElement && clockRatio == hwNode.clockRatio && diff --git a/src/main/java/tmltranslator/HwVGMN.java b/src/main/java/tmltranslator/HwVGMN.java index 20e90aea6e09304be5f85a9c1d4ecfc648749a95..e0179783b37fbf3bbcada41888c38065e5dab668 100755 --- a/src/main/java/tmltranslator/HwVGMN.java +++ b/src/main/java/tmltranslator/HwVGMN.java @@ -63,9 +63,9 @@ public class HwVGMN extends HwCommunicationNode { return s; } - public boolean equalSpec(Object o) { + public boolean equalsSpec(Object o) { if (!(o instanceof HwVGMN)) return false; - if (!super.equalSpec(o)) return false; + if (!super.equalsSpec(o)) return false; HwVGMN hwVGMN = (HwVGMN) o; return byteDataSize == hwVGMN.byteDataSize; diff --git a/src/main/java/tmltranslator/SecurityPattern.java b/src/main/java/tmltranslator/SecurityPattern.java index cea922d4eb7b5a96ad4212a5d41b78ee8b735c3c..11e627093a04f477bbc5ed2070ba010fd490f6da 100644 --- a/src/main/java/tmltranslator/SecurityPattern.java +++ b/src/main/java/tmltranslator/SecurityPattern.java @@ -43,7 +43,6 @@ package tmltranslator; import avatartranslator.AvatarState; import myutil.TraceManager; -import java.util.Locale; import java.util.Objects; @@ -226,7 +225,7 @@ public class SecurityPattern { this.algorithm = algorithm; } - public boolean equalSpec(Object o) { + public boolean equalsSpec(Object o) { if (!(o instanceof SecurityPattern)) return false; SecurityPattern securityPattern = (SecurityPattern) o; diff --git a/src/main/java/tmltranslator/TMLActivity.java b/src/main/java/tmltranslator/TMLActivity.java index 7f2495a9df6a8c582d142678e9b396564fdb2ceb..bbd20dcfa6c1fab513a210fb701822ef7e96e1a7 100755 --- a/src/main/java/tmltranslator/TMLActivity.java +++ b/src/main/java/tmltranslator/TMLActivity.java @@ -870,13 +870,13 @@ public class TMLActivity extends TMLElement { - public boolean equalSpec(Object o) { + public boolean equalsSpec(Object o) { if (!(o instanceof TMLActivity)) return false; - if(!super.equalSpec(o)) return false; + if(!super.equalsSpec(o)) return false; TMLActivity tmlActivity = (TMLActivity) o; if (first != null) { - return first.equalSpec(tmlActivity.getFirst()); + return first.equalsSpec(tmlActivity.getFirst()); } else { return tmlActivity.getFirst() == null; } diff --git a/src/main/java/tmltranslator/TMLActivityElement.java b/src/main/java/tmltranslator/TMLActivityElement.java index 6fc0b81b742a4dc22fd8ea4f8d9322cf6935a8f2..1184b2fe409a65a71c46ecac7ea8fc7f9c5b5506 100755 --- a/src/main/java/tmltranslator/TMLActivityElement.java +++ b/src/main/java/tmltranslator/TMLActivityElement.java @@ -156,13 +156,12 @@ public abstract class TMLActivityElement extends TMLElement { public abstract String customExtraToXML(); - public boolean equalSpec(Object o) { + public boolean equalsSpec(Object o) { if (o == null || getClass() != o.getClass()) return false; TMLActivityElement tmlActEtls = (TMLActivityElement) o; - TMLComparingMethod comp = new TMLComparingMethod(); - return Objects.equals(value, tmlActEtls.getValue()) && comp.isSecurityPatternEquals(securityPattern, tmlActEtls.getSecurityPattern()) && - comp.isTMLActivityEltListEquals(nexts, tmlActEtls.getNexts()); + return Objects.equals(value, tmlActEtls.getValue()) && TMLComparingMethod.areSecurityPatternsEqual(securityPattern, tmlActEtls.getSecurityPattern()) && + TMLComparingMethod.areTMLActivityEltListsEqual(nexts, tmlActEtls.getNexts()); } public void setCheckableAccessibility(boolean b) { diff --git a/src/main/java/tmltranslator/TMLActivityElementChannel.java b/src/main/java/tmltranslator/TMLActivityElementChannel.java index 05d11a4eb9d76724d311a7fdbc9aaa1c8ace718a..cca4bf1710f4c444a63828f0545d4d529be687cd 100755 --- a/src/main/java/tmltranslator/TMLActivityElementChannel.java +++ b/src/main/java/tmltranslator/TMLActivityElementChannel.java @@ -126,12 +126,11 @@ public abstract class TMLActivityElementChannel extends TMLActivityElement { } @Override - public boolean equalSpec(Object o) { - if (!super.equalSpec(o)) return false; + public boolean equalsSpec(Object o) { + if (!super.equalsSpec(o)) return false; TMLActivityElementChannel tmlActEltChannel = (TMLActivityElementChannel) o; - // TMLComparingMethod comp = new TMLComparingMethod(); // Check if the two TMLActivityElementChannel have the same channels list. - // if (!comp.isTMLChannelListEquals(channels, tmlActEltChannel.channels)) return false; + // if (!TMLComparingMethod.areTMLChannelListsEqual(channels, tmlActEltChannel.channels)) return false; return Objects.equals(nbOfSamples, tmlActEltChannel.getNbOfSamples()) && isAttacker == tmlActEltChannel.isAttacker(); } diff --git a/src/main/java/tmltranslator/TMLActivityElementEvent.java b/src/main/java/tmltranslator/TMLActivityElementEvent.java index b5062ce3521abd5d2213a502cb4425d45abcafbd..7ef6aa3e71806ef9a2aa6778bd08e2f461ebb186 100755 --- a/src/main/java/tmltranslator/TMLActivityElementEvent.java +++ b/src/main/java/tmltranslator/TMLActivityElementEvent.java @@ -145,21 +145,21 @@ public abstract class TMLActivityElementEvent extends TMLActivityElement { } @Override - public boolean equalSpec(Object o) { - if (!super.equalSpec(o)) return false; + public boolean equalsSpec(Object o) { + if (!super.equalsSpec(o)) return false; TMLActivityElementEvent tmlActivityElementEvent = (TMLActivityElementEvent) o; // Check if the two TMLActivityElementEvent have the same events list. /*for (TMLEvent evt1 : events) { boolean isEqualEvt = false; for (TMLEvent evt2 : tmlActivityElementEvent.getEvents()) { - if (evt1.equalSpec(evt2)) { + if (evt1.equalsSpec(evt2)) { isEqualEvt = true; break; } } if (!isEqualEvt) return false; } - if (!event.equalSpec(tmlActivityElementEvent.getEvent())) return false;*/ + if (!event.equalsSpec(tmlActivityElementEvent.getEvent())) return false;*/ return (new HashSet<>(datas)).equals(new HashSet<>(tmlActivityElementEvent.getDatas())) && Objects.equals(variable, tmlActivityElementEvent.getVariable()); } diff --git a/src/main/java/tmltranslator/TMLActivityElementWithAction.java b/src/main/java/tmltranslator/TMLActivityElementWithAction.java index 513529e9b3008fa3b562e35f3c773d8de169610e..3e0b548ccaba0dc69629495e50b0b3b8c74e1e4b 100755 --- a/src/main/java/tmltranslator/TMLActivityElementWithAction.java +++ b/src/main/java/tmltranslator/TMLActivityElementWithAction.java @@ -41,8 +41,6 @@ package tmltranslator; -import translator.CheckingError; - import java.util.Objects; /** @@ -79,8 +77,8 @@ public abstract class TMLActivityElementWithAction extends TMLActivityElement { } @Override - public boolean equalSpec(Object o) { - if (!super.equalSpec(o)) return false; + public boolean equalsSpec(Object o) { + if (!super.equalsSpec(o)) return false; TMLActivityElementWithAction tmlActivityElementWithAction = (TMLActivityElementWithAction) o; return Objects.equals(action, tmlActivityElementWithAction.getAction()); } diff --git a/src/main/java/tmltranslator/TMLActivityElementWithIntervalAction.java b/src/main/java/tmltranslator/TMLActivityElementWithIntervalAction.java index a1400ba132073039b682f201888698d147cf1057..105e7fa464b275c3e1abec0871bd2e0b0186dba2 100755 --- a/src/main/java/tmltranslator/TMLActivityElementWithIntervalAction.java +++ b/src/main/java/tmltranslator/TMLActivityElementWithIntervalAction.java @@ -84,8 +84,8 @@ public abstract class TMLActivityElementWithIntervalAction extends TMLActivityEl public boolean getActiveDelay(){return isActiveDelay;} @Override - public boolean equalSpec(Object o) { - if (!super.equalSpec(o)) return false; + public boolean equalsSpec(Object o) { + if (!super.equalsSpec(o)) return false; TMLActivityElementWithIntervalAction tmlAEIAction = (TMLActivityElementWithIntervalAction) o; return Objects.equals(minDelay, tmlAEIAction.getMinDelay()) && diff --git a/src/main/java/tmltranslator/TMLArchitecture.java b/src/main/java/tmltranslator/TMLArchitecture.java index 71d27850747115bff20307359d8977bbc45857ab..f38b69b54d17ad617c6961ec1d03f44515745d5a 100755 --- a/src/main/java/tmltranslator/TMLArchitecture.java +++ b/src/main/java/tmltranslator/TMLArchitecture.java @@ -38,8 +38,6 @@ package tmltranslator; -import myutil.TraceManager; - import java.util.*; /** @@ -556,7 +554,7 @@ public class TMLArchitecture { return (noc == null ? -1 : noc.size); } - public boolean equalSpec(Object o) { + public boolean equalsSpec(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) @@ -564,12 +562,10 @@ public class TMLArchitecture { TMLArchitecture that = (TMLArchitecture) o; - TMLComparingMethod comp = new TMLComparingMethod(); - - if (!comp.isHwNodeListEquals(hwnodes, that.hwnodes)) + if (!TMLComparingMethod.areHwNodeListsEqual(hwnodes, that.hwnodes)) return false; - if (!comp.isHwlinkListEquals(hwlinks, that.hwlinks)) + if (!TMLComparingMethod.areHwlinkListsEqual(hwlinks, that.hwlinks)) return false; return masterClockFrequency == that.masterClockFrequency; diff --git a/src/main/java/tmltranslator/TMLAttribute.java b/src/main/java/tmltranslator/TMLAttribute.java index c73068f95ec31a3b44c5f704c5c0d3fa989fdc21..7c67ad8dc0c976bf86383e2fe9f80f09690b96c1 100755 --- a/src/main/java/tmltranslator/TMLAttribute.java +++ b/src/main/java/tmltranslator/TMLAttribute.java @@ -149,12 +149,12 @@ public class TMLAttribute extends DIPLOElement { //return ( (name.equals( _other.getName() )) && ( initialValue.equals( _other.getInitialValue() )) && (type.equals( _other.getType() )) ); } - public boolean equalSpec(Object o) { + public boolean equalsSpec(Object o) { if (!(o instanceof TMLAttribute)) { return false; } TMLAttribute attr = (TMLAttribute) o; - return (name.equals(attr.getName())) && (initialValue.equals(attr.getInitialValue())) && (type.equalSpec(attr.getType())); + return (name.equals(attr.getName())) && (initialValue.equals(attr.getInitialValue())) && (type.equalsSpec(attr.getType())); } @Override public int hashCode() { diff --git a/src/main/java/tmltranslator/TMLChannel.java b/src/main/java/tmltranslator/TMLChannel.java index 060f7528edbc3dd43bf4080cccccbaa56084d5a7..d02b555335ef6122744decf6f02de1b083d0d7da 100755 --- a/src/main/java/tmltranslator/TMLChannel.java +++ b/src/main/java/tmltranslator/TMLChannel.java @@ -658,32 +658,31 @@ public class TMLChannel extends TMLCommunicationElement { return s; } - public boolean equalSpec(Object o) { + public boolean equalsSpec(Object o) { if (!(o instanceof TMLChannel)) return false; - if (!super.equalSpec(o)) return false; + if (!super.equalsSpec(o)) return false; TMLChannel channel = (TMLChannel) o; - TMLComparingMethod comp = new TMLComparingMethod(); //TraceManager.addDev("Comparing channel ports"); if (originPort != null) { - if (!originPort.equalSpec(channel.getOriginPort())) + if (!originPort.equalsSpec(channel.getOriginPort())) return false; } if (destinationPort != null) { - if (!destinationPort.equalSpec(channel.getDestinationPort())) return false; + if (!destinationPort.equalsSpec(channel.getDestinationPort())) return false; } //TraceManager.addDev("Comparing channel tasks"); if (originTask != null) { - if (!originTask.equalSpec(channel.getOriginTask())) + if (!originTask.equalsSpec(channel.getOriginTask())) return false; } if (destinationTask != null) { - if (!destinationTask.equalSpec(channel.getDestinationTask())) return false; + if (!destinationTask.equalsSpec(channel.getDestinationTask())) return false; } //TraceManager.addDev("Comparing other attributes"); @@ -703,10 +702,10 @@ public class TMLChannel extends TMLCommunicationElement { //TraceManager.addDev("ret 1 = " + ret); ret = ret && - comp.isTasksListEquals(originTasks, channel.getOriginTasks()) && - comp.isTasksListEquals(destinationTasks, channel.getDestinationTasks()) && - comp.isPortListEquals(originPorts, channel.getOriginPorts()) && - comp.isPortListEquals(destinationPorts, channel.getDestinationPorts()); + TMLComparingMethod.areTaskListsEqual(originTasks, channel.getOriginTasks()) && + TMLComparingMethod.areTaskListsEqual(destinationTasks, channel.getDestinationTasks()) && + TMLComparingMethod.arePortListsEqual(originPorts, channel.getOriginPorts()) && + TMLComparingMethod.arePortListsEqual(destinationPorts, channel.getDestinationPorts()); //TraceManager.addDev("ret 2 = " + ret); diff --git a/src/main/java/tmltranslator/TMLChoice.java b/src/main/java/tmltranslator/TMLChoice.java index 9d0797e11f4f67b31fe0df3fb443260949b6878d..e47cfd5beb67b207392284152004d0d4834aa442 100755 --- a/src/main/java/tmltranslator/TMLChoice.java +++ b/src/main/java/tmltranslator/TMLChoice.java @@ -39,12 +39,10 @@ package tmltranslator; import myutil.Conversion; -import translator.CheckingError; import java.util.ArrayList; import java.util.HashSet; import java.util.List; -import java.util.Objects; /** * Class TMLChoice @@ -352,8 +350,8 @@ public class TMLChoice extends TMLActivityElement{ } @Override - public boolean equalSpec(Object o) { - if (!super.equalSpec(o)) return false; + public boolean equalsSpec(Object o) { + if (!super.equalsSpec(o)) return false; TMLChoice tmlChoice = (TMLChoice) o; return (new HashSet<>(guards)).equals(new HashSet<>(tmlChoice.getGuards())); } diff --git a/src/main/java/tmltranslator/TMLCommunicationElement.java b/src/main/java/tmltranslator/TMLCommunicationElement.java index 6f8c7d3872d5c840a0e4f6c44d3ecc708a74c2ee..ed7d711eed28290e420f058254cb514b01ab6d21 100755 --- a/src/main/java/tmltranslator/TMLCommunicationElement.java +++ b/src/main/java/tmltranslator/TMLCommunicationElement.java @@ -43,8 +43,6 @@ package tmltranslator; import myutil.TraceManager; -import java.util.Objects; - /** * Class TMLCommunicationElement * Creation: 22/11/2005 @@ -93,9 +91,9 @@ public abstract class TMLCommunicationElement extends TMLElement { maxNbOfLoss = _maxNbOfLoss; } - public boolean equalSpec(Object o) { + public boolean equalsSpec(Object o) { if (!(o instanceof TMLCommunicationElement)) return false; - if (!super.equalSpec(o)) return false; + if (!super.equalsSpec(o)) return false; TMLCommunicationElement that = (TMLCommunicationElement) o; return isLossy == that.isLossy && lossPercentage == that.lossPercentage && diff --git a/src/main/java/tmltranslator/TMLComparingMethod.java b/src/main/java/tmltranslator/TMLComparingMethod.java index b27ceaaacc434c682515b4973ecfd90801bdeff1..b579345c07b1038028e1a8a46812da0bb794a2c5 100644 --- a/src/main/java/tmltranslator/TMLComparingMethod.java +++ b/src/main/java/tmltranslator/TMLComparingMethod.java @@ -7,7 +7,7 @@ import java.util.*; public class TMLComparingMethod { TMLComparingMethod() {} - public boolean isOncommondesListEquals(List<HwCommunicationNode> list1, List<HwCommunicationNode> list2){ + public static boolean areOncommondesListsEqual(List<HwCommunicationNode> list1, List<HwCommunicationNode> list2){ if (list1 == null && list2 == null) { return true; } @@ -32,14 +32,14 @@ public class TMLComparingMethod { for (int i = 0; i < list1.size(); i++) { TraceManager.addDev("Testing equality for " + list1.get(i).getName() + " and " + list2.get(i).getName()); - test = list1.get(i).equalSpec(list2.get(i)); + test = list1.get(i).equalsSpec(list2.get(i)); if (!test) return false; } return true; } - public boolean isMappedcommeltsListEquals(List<TMLElement> list1, List<TMLElement> list2){ + public static boolean areMappedcommeltsListsEqual(List<TMLElement> list1, List<TMLElement> list2){ if (list1 == null && list2 == null) { return true; } @@ -61,14 +61,14 @@ public class TMLComparingMethod { boolean test; for (int i = 0; i < list1.size(); i++) { - test = list1.get(i).equalSpec(list2.get(i)); + test = list1.get(i).equalsSpec(list2.get(i)); if (!test) return false; } return true; } - public boolean isTasksListEquals(List<TMLTask> list1, List<TMLTask> list2){ + public static boolean areTaskListsEqual(List<TMLTask> list1, List<TMLTask> list2){ if (list1 == null && list2 == null) { return true; } @@ -90,14 +90,14 @@ public class TMLComparingMethod { boolean test; for (int i = 0; i < list1.size(); i++) { - test = list1.get(i).equalSpec(list2.get(i)); + test = list1.get(i).equalsSpec(list2.get(i)); if (!test) return false; } return true; } - public boolean isOnExecutionNodeListEquals(List<HwExecutionNode> list1, List<HwExecutionNode> list2){ + public static boolean areOnExecutionNodeListsEqual(List<HwExecutionNode> list1, List<HwExecutionNode> list2){ if (list1 == null && list2 == null) { return true; } @@ -119,14 +119,14 @@ public class TMLComparingMethod { boolean test; for (int i = 0; i < list1.size(); i++) { - test = list1.get(i).equalSpec(list2.get(i)); + test = list1.get(i).equalsSpec(list2.get(i)); if (!test) return false; } return true; } - public boolean isListOfStringArrayEquals(List<String[]> list1, List<String[]> list2) { + public static boolean areListsOfStringArrayEqual(List<String[]> list1, List<String[]> list2) { if (list1 == null && list2 == null) { return true; @@ -179,7 +179,7 @@ public class TMLComparingMethod { return true; } - public boolean isKeyMappingEquals(Map<SecurityPattern, List<HwMemory>> map1, Map<SecurityPattern, List<HwMemory>> map2) { + public static boolean areKeysMappingEqual(Map<SecurityPattern, List<HwMemory>> map1, Map<SecurityPattern, List<HwMemory>> map2) { if (map1 == null && map2 == null) { return true; @@ -196,7 +196,7 @@ public class TMLComparingMethod { boolean isEqual = false; for (SecurityPattern spMap2 : map2.keySet()) { if (spMap1.getName().equals(spMap2.getName())) { - test = isHwMemoryListEquals(map1.get(spMap1), map2.get(spMap2)); + test = areHwMemoryListsEqual(map1.get(spMap1), map2.get(spMap2)); if (!test) return false; isEqual = true; break; @@ -208,7 +208,7 @@ public class TMLComparingMethod { return true; } - public boolean isHwMemoryListEquals (List<HwMemory> list1, List<HwMemory> list2) { + public static boolean areHwMemoryListsEqual(List<HwMemory> list1, List<HwMemory> list2) { if (list1 == null && list2 == null) { return true; } @@ -230,14 +230,14 @@ public class TMLComparingMethod { boolean test; for (int i = 0; i < list1.size(); i++) { - test = list1.get(i).equalSpec(list2.get(i)); + test = list1.get(i).equalsSpec(list2.get(i)); if (!test) return false; } return true; } - public boolean isTMLActivityEltListEquals(List<TMLActivityElement> list1, List<TMLActivityElement> list2){ + public static boolean areTMLActivityEltListsEqual(List<TMLActivityElement> list1, List<TMLActivityElement> list2){ if (list1 == null && list2 == null) { return true; } @@ -250,12 +250,12 @@ public class TMLComparingMethod { } for (int i = 0; i < list1.size(); i++) { - if (!list1.get(i).equalSpec(list2.get(i))) return false; + if (!list1.get(i).equalsSpec(list2.get(i))) return false; } return true; } - public boolean isHwNodeListEquals(List<HwNode> list1, List<HwNode> list2){ + public static boolean areHwNodeListsEqual(List<HwNode> list1, List<HwNode> list2){ if (list1 == null && list2 == null) { return true; } @@ -277,7 +277,7 @@ public class TMLComparingMethod { boolean test; for (int i = 0; i < list1.size(); i++) { - test = list1.get(i).equalSpec(list2.get(i)); + test = list1.get(i).equalsSpec(list2.get(i)); if (!test) return false; } @@ -285,7 +285,7 @@ public class TMLComparingMethod { } - public boolean isHwlinkListEquals(List<HwLink> list1, List<HwLink> list2){ + public static boolean areHwlinkListsEqual(List<HwLink> list1, List<HwLink> list2){ if (list1 == null && list2 == null) { return true; } @@ -307,14 +307,14 @@ public class TMLComparingMethod { boolean test; for (int i = 0; i < list1.size(); i++) { - test = list1.get(i).equalSpec(list2.get(i)); + test = list1.get(i).equalsSpec(list2.get(i)); if (!test) return false; } return true; } - public boolean isPortListEquals(List<TMLPort> list1, List<TMLPort> list2){ + public static boolean arePortListsEqual(List<TMLPort> list1, List<TMLPort> list2){ if (list1 == null && list2 == null) { return true; } @@ -336,14 +336,14 @@ public class TMLComparingMethod { boolean test; for (int i = 0; i < list1.size(); i++) { - test = list1.get(i).equalSpec(list2.get(i)); + test = list1.get(i).equalsSpec(list2.get(i)); if (!test) return false; } return true; } - public boolean isTMLChannelSetEquals(Set<TMLChannel> channelSet1, Set<TMLChannel> channelSet2) { + public static boolean areTMLChannelSetsEqual(Set<TMLChannel> channelSet1, Set<TMLChannel> channelSet2) { if (channelSet1 == null && channelSet2 == null) return true; if (channelSet1 == null || channelSet2 == null) return false; @@ -358,14 +358,14 @@ public class TMLComparingMethod { boolean test; for (int i = 0; i < channels1.size(); i++) { - test = channels1.get(i).equalSpec(channels2.get(i)); + test = channels1.get(i).equalsSpec(channels2.get(i)); if (!test) return false; } return true; } - public boolean isTMLEventSetEquals(Set<TMLEvent> eventSet1, Set<TMLEvent> eventSet2) { + public static boolean areTMLEventSetsEqual(Set<TMLEvent> eventSet1, Set<TMLEvent> eventSet2) { if (eventSet1 == null && eventSet2 == null) return true; if (eventSet1 == null|| eventSet2 == null) return false; @@ -380,23 +380,23 @@ public class TMLComparingMethod { boolean test; for (int i = 0; i < events1.size(); i++) { - test = events1.get(i).equalSpec(events2.get(i)); + test = events1.get(i).equalsSpec(events2.get(i)); if (!test) return false; } return true; } // Check equality of two security pattern specifications - public boolean isSecurityPatternEquals(SecurityPattern sp1, SecurityPattern sp2) { + public static boolean areSecurityPatternsEqual(SecurityPattern sp1, SecurityPattern sp2) { if (sp1 == null && sp2 == null) return true; else if (sp1 == null || sp2 == null) { return false; } - return (sp1.equalSpec(sp2)); + return (sp1.equalsSpec(sp2)); } // Check equality of two TMLAttribute Lists - public boolean isTMLAttributeListEquals(List<TMLAttribute> attributeList1, List<TMLAttribute> attributeList2) { + public static boolean areTMLAttributeListsEqual(List<TMLAttribute> attributeList1, List<TMLAttribute> attributeList2) { if (attributeList1 == null && attributeList2 == null) return true; if (attributeList1 == null || attributeList2 == null) return false; if(attributeList1.size() != attributeList2.size()) return false; @@ -404,7 +404,7 @@ public class TMLComparingMethod { for (TMLAttribute attrib : attributeList1) { boolean isEqualAttrib = false; for (TMLAttribute attrib2 : attributeList2) { - if (!attrib.equalSpec(attrib2)) { + if (!attrib.equalsSpec(attrib2)) { isEqualAttrib = true; break; } @@ -415,7 +415,7 @@ public class TMLComparingMethod { } // Check if the two TMLActivityElementChannel have the same channels list. - public boolean isTMLChannelListEquals(List<TMLChannel> channelList1, List<TMLChannel> channelList2) { + public static boolean areTMLChannelListsEqual(List<TMLChannel> channelList1, List<TMLChannel> channelList2) { if (channelList1 == null && channelList2 == null) return true; if (channelList1 == null || channelList2 == null) return false; if(channelList1.size() != channelList2.size()) return false; @@ -423,7 +423,7 @@ public class TMLComparingMethod { for (TMLChannel ch : channelList1) { boolean isEqualChan = false; for (TMLChannel ch2 : channelList2) { - if (!ch.equalSpec(ch2)) { + if (!ch.equalsSpec(ch2)) { isEqualChan = true; break; } diff --git a/src/main/java/tmltranslator/TMLDelay.java b/src/main/java/tmltranslator/TMLDelay.java index 3510ae48dc1b9b91953550c202c02f5767dd0606..24d437038b63adf392cd12b196ce3f8989823831 100755 --- a/src/main/java/tmltranslator/TMLDelay.java +++ b/src/main/java/tmltranslator/TMLDelay.java @@ -94,8 +94,8 @@ public class TMLDelay extends TMLActivityElementWithIntervalAction { } @Override - public boolean equalSpec(Object o) { - if (!super.equalSpec(o)) return false; + public boolean equalsSpec(Object o) { + if (!super.equalsSpec(o)) return false; TMLDelay tmlDelay = (TMLDelay) o; return Objects.equals(timeUnit,tmlDelay.getUnit()); diff --git a/src/main/java/tmltranslator/TMLElement.java b/src/main/java/tmltranslator/TMLElement.java index 76c10130e842a4a75128aa479973f4f7152988ad..7de0254822d65ce6f97bc3f5ab9728d140ba17a3 100755 --- a/src/main/java/tmltranslator/TMLElement.java +++ b/src/main/java/tmltranslator/TMLElement.java @@ -97,7 +97,7 @@ public class TMLElement extends DIPLOElement { this.referenceObject = _referenceObject; } - public boolean equalSpec(Object o) { + public boolean equalsSpec(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; TMLElement that = (TMLElement) o; diff --git a/src/main/java/tmltranslator/TMLEvent.java b/src/main/java/tmltranslator/TMLEvent.java index 91b67b8b72c419b4200475fec87147d165771e90..3b4a5ee87f62c3e83d7f444cff99103d64db6076 100755 --- a/src/main/java/tmltranslator/TMLEvent.java +++ b/src/main/java/tmltranslator/TMLEvent.java @@ -39,8 +39,6 @@ package tmltranslator; -import myutil.TraceManager; -import org.apache.batik.anim.timing.Trace; import translator.CheckingError; import java.util.ArrayList; @@ -357,33 +355,31 @@ public class TMLEvent extends TMLCommunicationElement { return s; } - public boolean equalSpec(Object o) { + public boolean equalsSpec(Object o) { if (!(o instanceof TMLEvent)) return false; - if (!super.equalSpec(o)) return false; + if (!super.equalsSpec(o)) return false; TMLEvent event = (TMLEvent) o; - TMLComparingMethod comp = new TMLComparingMethod(); - //TraceManager.addDev(("Event: testing origin port")); if (originPort != null) { - if (!originPort.equalSpec(event.getOriginPort())) + if (!originPort.equalsSpec(event.getOriginPort())) return false; } //TraceManager.addDev(("Event: testing destination port")); if (destinationPort != null) { - if (!destinationPort.equalSpec(event.getDestinationPort())) return false; + if (!destinationPort.equalsSpec(event.getDestinationPort())) return false; } //TraceManager.addDev(("Event: testing origin")); if (origin != null) { - if (!origin.equalSpec(event.getOriginTask())) + if (!origin.equalsSpec(event.getOriginTask())) return false; } //TraceManager.addDev(("Event: testing destination")); if (destination != null) { - if (!destination.equalSpec(event.getDestinationTask())) return false; + if (!destination.equalsSpec(event.getDestinationTask())) return false; } //TraceManager.addDev(("Event: testing params")); @@ -396,10 +392,10 @@ public class TMLEvent extends TMLCommunicationElement { checkAuth == event.checkAuth && checkConf == event.checkConf && canBeNotified == event.canBeNotified() && - comp.isTasksListEquals(originTasks, event.getOriginTasks()) && - comp.isTasksListEquals(destinationTasks, event.getDestinationTasks()) && - comp.isPortListEquals(originPorts, event.getOriginPorts()) && - comp.isPortListEquals(destinationPorts, event.getDestinationPorts()); + TMLComparingMethod.areTaskListsEqual(originTasks, event.getOriginTasks()) && + TMLComparingMethod.areTaskListsEqual(destinationTasks, event.getDestinationTasks()) && + TMLComparingMethod.arePortListsEqual(originPorts, event.getOriginPorts()) && + TMLComparingMethod.arePortListsEqual(destinationPorts, event.getDestinationPorts()); } public TMLEvent deepClone(TMLModeling tmlm) throws TMLCheckingError { diff --git a/src/main/java/tmltranslator/TMLExecC.java b/src/main/java/tmltranslator/TMLExecC.java index dddc500dd436394246e690bf2c88569d54280113..f0d8c399acdd36077987724630fa01c2f8fb6eca 100755 --- a/src/main/java/tmltranslator/TMLExecC.java +++ b/src/main/java/tmltranslator/TMLExecC.java @@ -73,8 +73,8 @@ public class TMLExecC extends TMLActivityElementWithAction { } @Override - public boolean equalSpec(Object o) { - if (!super.equalSpec(o)) return false; + public boolean equalsSpec(Object o) { + if (!super.equalsSpec(o)) return false; TMLExecC tmlExecC = (TMLExecC) o; return Objects.equals(isDecryptionProcess, tmlExecC.isDecryptionProcess()); } diff --git a/src/main/java/tmltranslator/TMLForLoop.java b/src/main/java/tmltranslator/TMLForLoop.java index 6a030b569eea8accfb9c23e3b3bf44eb11da0bcb..b6fb1be533509b68290c5a5a846df19ed7339fa3 100755 --- a/src/main/java/tmltranslator/TMLForLoop.java +++ b/src/main/java/tmltranslator/TMLForLoop.java @@ -84,8 +84,8 @@ public class TMLForLoop extends TMLActivityElement { } @Override - public boolean equalSpec(Object o) { - if(!super.equalSpec(o)) return false; + public boolean equalsSpec(Object o) { + if(!super.equalsSpec(o)) return false; TMLForLoop tmlForLoop = (TMLForLoop) o; return Objects.equals(init, tmlForLoop.getInit()) && Objects.equals(condition, tmlForLoop.getCondition()) && diff --git a/src/main/java/tmltranslator/TMLMapping.java b/src/main/java/tmltranslator/TMLMapping.java index 8f830bd6eb1cc90ed19f68749166f8029745dd75..b32bd9bd2a636634add21eec6979e1394b2db810 100755 --- a/src/main/java/tmltranslator/TMLMapping.java +++ b/src/main/java/tmltranslator/TMLMapping.java @@ -1916,43 +1916,42 @@ public class TMLMapping<E> { return cpt; } - public boolean equalSpec(Object o) { + public boolean equalsSpec(Object o) { if (!(o instanceof TMLMapping)) return false; TMLMapping<?> that = (TMLMapping<?>) o; - TMLComparingMethod comp = new TMLComparingMethod(); //TraceManager.addDev("Testing isOncommondesListEquals"); - if (!comp.isOncommondesListEquals(oncommnodes, that.getCommunicationNodes())) + if (!TMLComparingMethod.areOncommondesListsEqual(oncommnodes, that.getCommunicationNodes())) return false; //TraceManager.addDev("Testing isMappedcommeltsListEquals"); - if (!comp.isMappedcommeltsListEquals(mappedcommelts, that.getMappedCommunicationElement())) + if (!TMLComparingMethod.areMappedcommeltsListsEqual(mappedcommelts, that.getMappedCommunicationElement())) return false; ////TraceManager.addDev("Testing isTasksListEquals"); - if (!comp.isTasksListEquals(mappedtasks, that.getMappedTasks())) + if (!TMLComparingMethod.areTaskListsEqual(mappedtasks, that.getMappedTasks())) return false; //TraceManager.addDev("Testing isOnExecutionNodeListEquals"); - if (!comp.isOnExecutionNodeListEquals(onnodes, that.getNodes())) + if (!TMLComparingMethod.areOnExecutionNodeListsEqual(onnodes, that.getNodes())) return false; //TraceManager.addDev("Testing pragmas"); - if (!comp.isListOfStringArrayEquals(pragmas, that.getPragmas())) + if (!TMLComparingMethod.areListsOfStringArrayEqual(pragmas, that.getPragmas())) return false; //TraceManager.addDev("Testing mapped secu"); - if (!comp.isKeyMappingEquals(mappedSecurity, that.mappedSecurity)) + if (!TMLComparingMethod.areKeysMappingEqual(mappedSecurity, that.mappedSecurity)) return false; - return tmlm.equalSpec(that.tmlm) && tmla.equalSpec(that.tmla) && firewall == that.firewall; + return tmlm.equalsSpec(that.tmlm) && tmla.equalsSpec(that.tmla) && firewall == that.firewall; } public void remap(HwExecutionNode src, HwExecutionNode dst) { diff --git a/src/main/java/tmltranslator/TMLModeling.java b/src/main/java/tmltranslator/TMLModeling.java index 701165fb33c0ba77391d6b5f7879e6d3c41049bd..471d834c631bf9fffacaf6a6051b6739bedba425 100755 --- a/src/main/java/tmltranslator/TMLModeling.java +++ b/src/main/java/tmltranslator/TMLModeling.java @@ -2803,7 +2803,7 @@ public class TMLModeling<E> { } } - public boolean equalSpec(Object o) { + public boolean equalsSpec(Object o) { TraceManager.addDev("Equal Spec: testing"); @@ -2865,7 +2865,7 @@ public class TMLModeling<E> { TraceManager.addDev("List of tasks sorted"); for (int i = 0; i < list1.size(); i++) { TraceManager.addDev("Comparing " + list1.get(i).getName() + " with " + list2.get(i).getName()); - test = list1.get(i).equalSpec(list2.get(i)); + test = list1.get(i).equalsSpec(list2.get(i)); if (!test) { TraceManager.addDev("Returning false"); return false; @@ -2896,7 +2896,7 @@ public class TMLModeling<E> { boolean test; for (int i = 0; i < list1.size(); i++) { - test = list1.get(i).equalSpec(list2.get(i)); + test = list1.get(i).equalsSpec(list2.get(i)); if (!test) return false; } @@ -2925,7 +2925,7 @@ public class TMLModeling<E> { boolean test; for (int i = 0; i < list1.size(); i++) { - test = list1.get(i).equalSpec(list2.get(i)); + test = list1.get(i).equalsSpec(list2.get(i)); if (!test) return false; } @@ -2953,7 +2953,7 @@ public class TMLModeling<E> { boolean test; for (int i = 0; i < list1.size(); i++) { - test = list1.get(i).equalSpec(list2.get(i)); + test = list1.get(i).equalsSpec(list2.get(i)); if (!test) return false; } @@ -2981,7 +2981,7 @@ public class TMLModeling<E> { boolean test; for (int i = 0; i < list1.size(); i++) { - test = list1.get(i).equalSpec(list2.get(i)); + test = list1.get(i).equalsSpec(list2.get(i)); if (!test) return false; } diff --git a/src/main/java/tmltranslator/TMLPort.java b/src/main/java/tmltranslator/TMLPort.java index f7565e7ef324f2d115477094fb3440e1e896e33e..e00c4081d981849ccd30d3ca05286e4a29c50b5f 100755 --- a/src/main/java/tmltranslator/TMLPort.java +++ b/src/main/java/tmltranslator/TMLPort.java @@ -104,9 +104,9 @@ public class TMLPort extends TMLElement { dataFlowType = _dataFlowType; } - public boolean equalSpec(Object o) { + public boolean equalsSpec(Object o) { if (!(o instanceof TMLPort)) return false; - if (!super.equalSpec(o)) return false; + if (!super.equalsSpec(o)) return false; TMLPort tmlPort = (TMLPort) o; return prex == tmlPort.isPrex() && diff --git a/src/main/java/tmltranslator/TMLRandom.java b/src/main/java/tmltranslator/TMLRandom.java index 613db754ba26d3c7b6ec4878391a0b87f8e634ea..3213477c804ab881aed49e39e855ac9b66eb6f7a 100755 --- a/src/main/java/tmltranslator/TMLRandom.java +++ b/src/main/java/tmltranslator/TMLRandom.java @@ -75,8 +75,8 @@ public class TMLRandom extends TMLActivityElement { } @Override - public boolean equalSpec(Object o) { - if (!super.equalSpec(o)) return false; + public boolean equalsSpec(Object o) { + if (!super.equalsSpec(o)) return false; TMLRandom tmlRandom = (TMLRandom) o; return Objects.equals(variable, tmlRandom.getVariable()) && diff --git a/src/main/java/tmltranslator/TMLRandomSequence.java b/src/main/java/tmltranslator/TMLRandomSequence.java index 29af794568a96b5499c4a7c871429933e54ab4e1..2f1ab1f519feac0bbdf1e2cce1251e0a10af1c25 100755 --- a/src/main/java/tmltranslator/TMLRandomSequence.java +++ b/src/main/java/tmltranslator/TMLRandomSequence.java @@ -107,8 +107,8 @@ public class TMLRandomSequence extends TMLActivityElement { } @Override - public boolean equalSpec(Object o) { - if (!super.equalSpec(o)) return false; + public boolean equalsSpec(Object o) { + if (!super.equalsSpec(o)) return false; TMLRandomSequence tmlRS = (TMLRandomSequence) o; return (new HashSet<>(indexes)).equals(new HashSet<>(tmlRS.getIndexes())); diff --git a/src/main/java/tmltranslator/TMLRequest.java b/src/main/java/tmltranslator/TMLRequest.java index d3e2fc3a16bc21088a2f25723d5eb65ec5bf1e3f..ae3a0cb35c1e8c205781dbfa8fed3fd0e0ec863f 100755 --- a/src/main/java/tmltranslator/TMLRequest.java +++ b/src/main/java/tmltranslator/TMLRequest.java @@ -180,11 +180,10 @@ public class TMLRequest extends TMLCommunicationElement { return s; } - public boolean equalSpec(Object o) { + public boolean equalsSpec(Object o) { if (!(o instanceof TMLRequest)) return false; - if (!super.equalSpec(o)) return false; + if (!super.equalsSpec(o)) return false; TMLRequest request = (TMLRequest) o; - TMLComparingMethod comp = new TMLComparingMethod(); if (destinationTask != null) { if (destinationTask.getName().compareTo(request.getDestinationTask().getName()) != 0) return false; @@ -199,7 +198,7 @@ public class TMLRequest extends TMLCommunicationElement { return confStatus == request.confStatus && checkConf == request.checkConf && checkAuth == request.checkAuth && - comp.isTasksListEquals(originTasks, request.getOriginTasks()); + TMLComparingMethod.areTaskListsEqual(originTasks, request.getOriginTasks()); } public TMLRequest deepClone(TMLModeling tmlm) throws TMLCheckingError { diff --git a/src/main/java/tmltranslator/TMLSendRequest.java b/src/main/java/tmltranslator/TMLSendRequest.java index 4ec2e96281e87d8f73b3d8ce21f1b717f3028f19..8b5cfc07cc1ffc521aa235c0653972f6ebbcdd59 100755 --- a/src/main/java/tmltranslator/TMLSendRequest.java +++ b/src/main/java/tmltranslator/TMLSendRequest.java @@ -124,11 +124,11 @@ public class TMLSendRequest extends TMLActivityElement { } @Override - public boolean equalSpec(Object o) { - if (!super.equalSpec(o)) return false; + public boolean equalsSpec(Object o) { + if (!super.equalsSpec(o)) return false; TMLSendRequest tmlSendRequest = (TMLSendRequest) o; - //if (!request.equalSpec(tmlSendRequest.getRequest())) return false; + //if (!request.equalsSpec(tmlSendRequest.getRequest())) return false; return (new HashSet<>(datas)).equals(new HashSet<>(tmlSendRequest.getDatas())); } diff --git a/src/main/java/tmltranslator/TMLSequence.java b/src/main/java/tmltranslator/TMLSequence.java index 90255352d4e8b9dbb962ed9c021e2221e93415a3..8c63f37aa963e1ef71111bb126b07781513841c7 100755 --- a/src/main/java/tmltranslator/TMLSequence.java +++ b/src/main/java/tmltranslator/TMLSequence.java @@ -102,8 +102,8 @@ public class TMLSequence extends TMLActivityElement { } @Override - public boolean equalSpec(Object o) { - if (!super.equalSpec(o)) return false; + public boolean equalsSpec(Object o) { + if (!super.equalsSpec(o)) return false; TMLSequence tmlSequence = (TMLSequence) o; return (new HashSet<>(indexes)).equals(new HashSet<>(tmlSequence.getIndexes())); diff --git a/src/main/java/tmltranslator/TMLTask.java b/src/main/java/tmltranslator/TMLTask.java index 8bf7e31152f8d28efc57fbe4b403c021af0206cd..d8969413bc87bedb86eeec8c66d744fabb12b053 100755 --- a/src/main/java/tmltranslator/TMLTask.java +++ b/src/main/java/tmltranslator/TMLTask.java @@ -39,8 +39,6 @@ package tmltranslator; -import myutil.TraceManager; - import java.util.*; /** @@ -556,22 +554,21 @@ public class TMLTask extends TMLElement { return eventsList; } - public boolean equalSpec(Object o) { + public boolean equalsSpec(Object o) { if (!(o instanceof TMLTask)) { //TraceManager.addDev("Returning false 1"); return false; } - if (!super.equalSpec(o)) { + if (!super.equalsSpec(o)) { //TraceManager.addDev("Returning false 2"); return false; } TMLTask tmlTask = (TMLTask) o; - TMLComparingMethod comp = new TMLComparingMethod(); //TraceManager.addDev("Going to compare requests of task " + getName() + " with task " + tmlTask.getName()); if (request != null) { - if (!request.equalSpec(tmlTask.getRequest())) { + if (!request.equalsSpec(tmlTask.getRequest())) { //TraceManager.addDev("Returning false 3"); return false; } @@ -583,7 +580,7 @@ public class TMLTask extends TMLElement { } //TraceManager.addDev("Going to compare attributes"); - if (!comp.isTMLAttributeListEquals(attributes, tmlTask.getAttributes())) return false; + if (!TMLComparingMethod.areTMLAttributeListsEqual(attributes, tmlTask.getAttributes())) return false; //TraceManager.addDev("HashSet of attributes ok"); @@ -598,11 +595,11 @@ public class TMLTask extends TMLElement { Objects.equals(operation, tmlTask.operation) && Objects.equals(operationMEC, tmlTask.operationMEC) && mustExit == tmlTask.exits() && - activity.equalSpec(tmlTask.activity) && - comp.isTMLChannelSetEquals(channelsList, tmlTask.getChannelSet()) && - comp.isTMLChannelSetEquals(readTMLChannelsList, tmlTask.getReadTMLChannelSet()) && - comp.isTMLChannelSetEquals(writeTMLChannelsList, tmlTask.getWriteTMLChannelSet()) && - comp.isTMLEventSetEquals(eventsList, tmlTask.getEventSet()); + activity.equalsSpec(tmlTask.activity) && + TMLComparingMethod.areTMLChannelSetsEqual(channelsList, tmlTask.getChannelSet()) && + TMLComparingMethod.areTMLChannelSetsEqual(readTMLChannelsList, tmlTask.getReadTMLChannelSet()) && + TMLComparingMethod.areTMLChannelSetsEqual(writeTMLChannelsList, tmlTask.getWriteTMLChannelSet()) && + TMLComparingMethod.areTMLEventSetsEqual(eventsList, tmlTask.getEventSet()); //TraceManager.addDev("Returning: " + ret); diff --git a/src/main/java/tmltranslator/TMLType.java b/src/main/java/tmltranslator/TMLType.java index 9f0d452183eeea3e96b3c84d076b5f2b067098da..8640c2b73b8b65f204b3e3b1228d5e1f7e2dac25 100755 --- a/src/main/java/tmltranslator/TMLType.java +++ b/src/main/java/tmltranslator/TMLType.java @@ -170,7 +170,7 @@ public class TMLType { return (getType() == tt.getType()); } - public boolean equalSpec(Object o) { + public boolean equalsSpec(Object o) { if (!(o instanceof TMLType)) { return false; } diff --git a/src/main/java/tmltranslator/compareTMLTest/CompareTMAP.java b/src/main/java/tmltranslator/compareTMLTest/CompareTMAP.java deleted file mode 100644 index b08417817eecb81d64c065f48951813124d6d70c..0000000000000000000000000000000000000000 --- a/src/main/java/tmltranslator/compareTMLTest/CompareTMAP.java +++ /dev/null @@ -1,111 +0,0 @@ -/* Copyright or (C) or Copr. GET / ENST, Telecom-Paris, Ludovic Apvrille - * - * ludovic.apvrille AT enst.fr - * - * This software is a computer program whose purpose is to allow the - * edition of TURTLE analysis, design and deployment diagrams, to - * allow the generation of RT-LOTOS or Java code from this diagram, - * and at last to allow the analysis of formal validation traces - * obtained from external tools, e.g. RTL from LAAS-CNRS and CADP - * from INRIA Rhone-Alpes. - * - * This software is governed by the CeCILL license under French law and - * abiding by the rules of distribution of free software. You can use, - * modify and/ or redistribute the software under the terms of the CeCILL - * license as circulated by CEA, CNRS and INRIA at the following URL - * "http://www.cecill.info". - * - * As a counterpart to the access to the source code and rights to copy, - * modify and redistribute granted by the license, users are provided only - * with a limited warranty and the software's author, the holder of the - * economic rights, and the successive licensors have only limited - * liability. - * - * In this respect, the user's attention is drawn to the risks associated - * with loading, using, modifying and/or developing or reproducing the - * software by the user in light of its specific status of free software, - * that may mean that it is complicated to manipulate, and that also - * therefore means that it is reserved for developers and experienced - * professionals having in-depth computer knowledge. Users are therefore - * encouraged to load and test the software's suitability as regards their - * requirements in conditions enabling the security of their systems and/or - * data to be ensured and, more generally, to use and operate it in the - * same conditions as regards security. - * - * The fact that you are presently reading this means that you have had - * knowledge of the CeCILL license and that you accept its terms. - */ - - -package tmltranslator.compareTMLTest; - -import java.io.BufferedReader; -import java.io.File; -import java.io.FileReader; -import java.util.ArrayList; -import java.util.List; - -/** - * Class CompareTMAP - * - * Creation: 13/11/2023 - * - * @author Jawher JERRAY - * @version 1.0 13/11/2023 - */ - -public class CompareTMAP { - - public CompareTMAP () { - - } - - public boolean CompareTMAPFiles(File expected, File clone) throws Exception { - - BufferedReader expectedReader = new BufferedReader(new FileReader(expected)); - BufferedReader cloneReader = new BufferedReader(new FileReader(clone)); - - String s1; - String s2; - List<String> expectedStringArray = new ArrayList<String>(); - List<String> cloneStringArray = new ArrayList<String>(); - - while ((s1 = expectedReader.readLine()) != null) { - if (s1.indexOf("//") >= 0) { - s1 = s1.substring(0, s1.indexOf("//")); - } - if (!s1.contains("#include") && s1.length() > 0) { - s1 = s1.trim(); - expectedStringArray.add(s1); - } - } - - while ((s2 = cloneReader.readLine()) != null){ - if (s2.indexOf("//") >= 0) { - s2 = s2.substring(0, s2.indexOf("//")); - } - if (!s2.contains("#include") && s2.length() > 0) { - s2 = s2.trim(); - cloneStringArray.add(s2); - } - } - expectedReader.close(); - cloneReader.close(); - - return checkEquality(expectedStringArray, cloneStringArray); - } - - public boolean checkEquality(List<String> s1, List<String> s2) { - for (String s : s1) { - if (s2.contains(s)) { - s2.remove(s); - } - } - - if (s2.size() == 0) { - return true; - } - - return false; - } -} diff --git a/src/main/java/tmltranslator/compareTMLTest/CompareTML.java b/src/main/java/tmltranslator/compareTMLTest/CompareTML.java deleted file mode 100644 index c2224290c71b3d7870b5b9a6de64b504e05fdb56..0000000000000000000000000000000000000000 --- a/src/main/java/tmltranslator/compareTMLTest/CompareTML.java +++ /dev/null @@ -1,59 +0,0 @@ -package tmltranslator.compareTMLTest; - -import java.io.BufferedReader; -import java.io.File; -import java.io.FileReader; -public class CompareTML { - - public CompareTML () { - - } - //#issue 82 - public boolean compareTML(File expected, File clone) throws Exception { - - BufferedReader expectedReader = new BufferedReader(new FileReader(expected)); - BufferedReader cloneReader = new BufferedReader(new FileReader(clone)); - - String expectedString = ""; - String cloneString = ""; - String s1; - String s2; - - while ((s1 = expectedReader.readLine()) != null) { - if (!s1.contains("//") && s1.length() > 0) { - s1 = s1.trim(); - expectedString += s1; - } - } - - while ((s2 = cloneReader.readLine()) != null){ - if (!s2.contains("//") && s2.length() > 0) { - s2 = s2.trim(); - cloneString += s2; - } - } - - String[] expectedStringArray = expectedString.split("\\s+"); - String[] cloneStringArray = cloneString.split("\\s+"); - return checkEquality(expectedStringArray,cloneStringArray); - } - - public boolean checkEquality(String[] s1, String[] s2) { - if (s1 == s2) - return true; - - if (s1 == null || s2 == null) - return false; - - int n = s1.length; - if (n != s2.length) - return false; - - for (int i = 0; i < n; i++) { - if (!s1[i].equals(s2[i])) - return false; - } - - return true; - } -} diff --git a/src/main/java/tmltranslator/modelcompiler/ArchUnitMEC.java b/src/main/java/tmltranslator/modelcompiler/ArchUnitMEC.java index 4ae26f0991f1156373ee0c2bf95477eea93dd408..df173e6ceab9fdaf7c249e8e6cc2cba1b168324d 100644 --- a/src/main/java/tmltranslator/modelcompiler/ArchUnitMEC.java +++ b/src/main/java/tmltranslator/modelcompiler/ArchUnitMEC.java @@ -39,7 +39,6 @@ package tmltranslator.modelcompiler; -import tmltranslator.HwNode; import tmltranslator.TMLArchitecture; import tmltranslator.TMLCheckingError; @@ -103,7 +102,7 @@ public abstract class ArchUnitMEC { return stringTypesArr[index]; } - public boolean equalSpec(Object o) { + public boolean equalsSpec(Object o) { if (!(o instanceof ArchUnitMEC)) return false; ArchUnitMEC that = (ArchUnitMEC) o; return index == that.getIndex() && diff --git a/src/main/java/tmltranslator/patternhandling/SecurityGenerationForTMAP.java b/src/main/java/tmltranslator/patternhandling/SecurityGenerationForTMAP.java index 46ef82b662cd127cb530651460ae5adf47ab941b..796d9b6ea6eb0660826043b92eafea4383a24e64 100644 --- a/src/main/java/tmltranslator/patternhandling/SecurityGenerationForTMAP.java +++ b/src/main/java/tmltranslator/patternhandling/SecurityGenerationForTMAP.java @@ -53,7 +53,6 @@ import avatartranslator.AvatarPragmaSecret; import avatartranslator.AvatarSpecification; import avatartranslator.toproverif.AVATAR2ProVerif; import common.ConfigurationTTool; -import launcher.RshClient; import myutil.FileUtils; import myutil.TraceManager; import org.apache.commons.math3.util.Pair; @@ -62,6 +61,8 @@ import tmltranslator.*; import tmltranslator.toavatarsec.TML2Avatar; import ui.TGComponent; +import java.io.BufferedReader; +import java.io.InputStreamReader; import java.io.Reader; import java.util.*; @@ -125,14 +126,16 @@ public class SecurityGenerationForTMAP implements Runnable { ProVerifSpec proverifSpec =avatar2proverif.generateProVerif(true, true, 3, true, true); FileUtils.saveFile(ConfigurationTTool.ProVerifCodeDirectory + "pvspec", proverifSpec.getStringSpec()); - - RshClient rshc = new RshClient(ConfigurationTTool.ProVerifVerifierHost); - - rshc.setCmd(ConfigurationTTool.ProVerifVerifierPath + " -in pitype " + ConfigurationTTool.ProVerifCodeDirectory + "pvspec"); - TraceManager.addDev(ConfigurationTTool.ProVerifVerifierPath + " -in pitype " + ConfigurationTTool.ProVerifCodeDirectory + "pvspec"); - rshc.sendExecuteCommandRequest(); - Reader data = rshc.getDataReaderFromProcess(); - + String cmd = ConfigurationTTool.ProVerifVerifierPath + " -in pitype " + ConfigurationTTool.ProVerifCodeDirectory + "pvspec"; + Process process; + Reader data; + try { + process = Runtime.getRuntime().exec(cmd); + data = new BufferedReader(new InputStreamReader(process.getInputStream())); + } catch (Exception e) { + TraceManager.addDev("FAILED: executing: " + cmd + ": " + e.getMessage()); + throw new RuntimeException(e); + } ProVerifOutputAnalyzer pvoa = avatar2proverif.getOutputAnalyzer(); pvoa.analyzeOutput(data, true); diff --git a/src/main/java/tmltranslator/toavatarsec/TML2Avatar.java b/src/main/java/tmltranslator/toavatarsec/TML2Avatar.java index b5f6ed9f6127342093deaffa796c5e3a04de819f..e5b61020e7798f7e879c68d3724f4a62c5285da0 100644 --- a/src/main/java/tmltranslator/toavatarsec/TML2Avatar.java +++ b/src/main/java/tmltranslator/toavatarsec/TML2Avatar.java @@ -1269,7 +1269,7 @@ public class TML2Avatar { if (security && nextAe.getSecurityPattern() != null) { if (nextAe instanceof TMLExecC) { if (((TMLExecC) nextAe).isDecryptionProcess()) { - if (nextAe.getSecurityPattern().equalSpec(ae.getSecurityPattern())) { + if (nextAe.getSecurityPattern().equalsSpec(ae.getSecurityPattern())) { if (!channelsSecAttributes.containsKey(nextAe)) { Set<String> tmp = new HashSet<>(); channelsSecAttributes.put(nextAe, tmp); @@ -1443,7 +1443,7 @@ public class TML2Avatar { if (security && prevAe.getSecurityPattern() != null) { if (prevAe instanceof TMLExecC) { if (!((TMLExecC) prevAe).isDecryptionProcess()) { - if (prevAe.getSecurityPattern().equalSpec(ae.getSecurityPattern())) { + if (prevAe.getSecurityPattern().equalsSpec(ae.getSecurityPattern())) { foundEncrytionOp = true; } } @@ -2149,7 +2149,7 @@ public class TML2Avatar { authPragmaMap.get(actElem).add(pragma); } if (actElem.getSecurityPattern() != null && actElem instanceof TMLActivityElementChannel && - actElem.getSecurityPattern().equalSpec(sec)) { + actElem.getSecurityPattern().equalsSpec(sec)) { TMLActivityElementChannel actCh = (TMLActivityElementChannel) actElem; for (int i = 0; i < actCh.getNbOfChannels(); i++) { TMLChannel chSec = actCh.getChannel(i); diff --git a/ttool/src/test/java/cli/CLIPatternHandlingTest.java b/ttool/src/test/java/cli/CLIPatternHandlingTest.java index 3226e0238906a3e14bcdcd05cf4101d32151d0ed..ac339612ecbbed3a6deacc908e5e53d61d53b7ac 100644 --- a/ttool/src/test/java/cli/CLIPatternHandlingTest.java +++ b/ttool/src/test/java/cli/CLIPatternHandlingTest.java @@ -48,28 +48,18 @@ package cli; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; -import java.io.BufferedReader; import java.io.File; -import java.io.FileReader; -import java.io.IOException; import java.util.ArrayList; import java.util.List; -import common.ConfigurationTTool; -import common.SpecConfigTTool; -import graph.AUTGraph; -import graph.AUTTransition; -import myutil.Conversion; +import myutil.FileUtils; import myutil.TraceManager; import org.junit.Test; import test.AbstractTest; -import tmltranslator.compareTMLTest.CompareTML; -import tmltranslator.compareTMLTest.CompareTMAP; import tmltranslator.TMLMapping; import tmltranslator.TMLMappingTextSpecification; import tmltranslator.TMLSyntaxChecking; import tmltranslator.TMLError; -import cli.PatternHandling; public class CLIPatternHandlingTest extends AbstractTest implements InterpreterOutputInterface { @@ -195,8 +185,7 @@ public class CLIPatternHandlingTest extends AbstractTest implements InterpreterO String expectedOutputTmap = myutil.FileUtils.loadFileData(fExpectedTmap); //TraceManager.addDev("\nExpected:>" + expectedOutputTmap + "<"); //TraceManager.addDev("\nObtained:>" + obtainedOutputTmap + "<"); - CompareTMAP ctmap = new CompareTMAP(); - assertTrue("comparing between 2 TMAP files", ctmap.CompareTMAPFiles(fObtainedTmap, fExpectedTmap)); + assertTrue("comparing between 2 TMAP files", FileUtils.CompareTMAPFiles(fObtainedTmap, fExpectedTmap)); String filePathObtainedTarchi = OBTAINED_MODELS_PATH + OBTAINED_MODELS_AFTER_INTEGRATING_TMR_TARCHI[i]; @@ -207,8 +196,7 @@ public class CLIPatternHandlingTest extends AbstractTest implements InterpreterO File fExpectedTarchi = new File(filePathExpectedTarchi); assertTrue(myutil.FileUtils.checkFileForOpen(fExpectedTarchi)); String expectedOutputTarchi = myutil.FileUtils.loadFileData(fExpectedTarchi); - CompareTMAP ctarchi = new CompareTMAP(); - assertTrue("comparing between 2 Tarchi files", ctarchi.CompareTMAPFiles(fObtainedTarchi, fExpectedTarchi)); + assertTrue("comparing between 2 Tarchi files", FileUtils.CompareTMAPFiles(fObtainedTarchi, fExpectedTarchi)); //TraceManager.addDev("\nExpected Tarchi:>" + expectedOutputTarchi + "<"); //TraceManager.addDev("\nObtained Tarchi:>" + obtainedOutputTarchi + "<"); @@ -220,8 +208,7 @@ public class CLIPatternHandlingTest extends AbstractTest implements InterpreterO File fExpectedTML = new File(filePathExpectedTML); assertTrue(myutil.FileUtils.checkFileForOpen(fExpectedTML)); String expectedOutputTML = myutil.FileUtils.loadFileData(fExpectedTML); - CompareTML ctml = new CompareTML(); - assertTrue("comparing between 2 TML files", ctml.compareTML(fObtainedTML, fExpectedTML)); + assertTrue("comparing between 2 TML files", FileUtils.compareTMLFiles(fObtainedTML, fExpectedTML)); //TraceManager.addDev("\nExpected TML:>" + expectedOutputTML + "<"); //TraceManager.addDev("\nObtained TML:>" + obtainedOutputTML + "<"); } diff --git a/ttool/src/test/java/tmltranslator/AutoSecurityGenerationDiplodocusTest.java b/ttool/src/test/java/tmltranslator/AutoSecurityGenerationDiplodocusTest.java index c2daff4055b30df536b0a9c1cb63d78401d3f282..4a14b97fa026325e29eacf1f3cca65c4a12f6bb5 100644 --- a/ttool/src/test/java/tmltranslator/AutoSecurityGenerationDiplodocusTest.java +++ b/ttool/src/test/java/tmltranslator/AutoSecurityGenerationDiplodocusTest.java @@ -1,7 +1,6 @@ package tmltranslator; import common.ConfigurationTTool; -import launcher.RshServer; import myutil.FileUtils; import myutil.TraceManager; import org.junit.Before; @@ -52,16 +51,7 @@ public class AutoSecurityGenerationDiplodocusTest extends AbstractTest { @Before public void setUp() throws Exception { TraceManager.devPolicy = TraceManager.TO_CONSOLE; - final Runnable runnable = new Runnable() { - @Override - public void run() { - new RshServer( null ).startServer(); - } - }; - Thread threadServer = new Thread( runnable ); - threadServer.start(); ConfigurationTTool.ProVerifVerifierPath = "proverif"; - ConfigurationTTool.ProVerifVerifierHost = "localhost"; TraceManager.addDev("Starting test for Security Generation"); Path path = Paths.get(PROVERIF_DIR); if (!Files.exists(path)) { @@ -278,7 +268,7 @@ public class AutoSecurityGenerationDiplodocusTest extends AbstractTest { ch.checkAuth = tmap.getChannelByName(ch.getName()).isCheckAuthChannel(); } } - assertTrue(tmapGolden.equalSpec(tmap)); + assertTrue(tmapGolden.equalsSpec(tmap)); TraceManager.addDev("Verifying Tmap equality ended " + tab); TraceManager.addDev("Test for " + tab + " tab is ended"); diff --git a/ttool/src/test/java/tmltranslator/CompareTMLTests.java b/ttool/src/test/java/tmltranslator/CompareTMLTests.java index 79520bf4e63bf723f887ae0ff96faa293e4d40fb..8cea3bbd19479ce7640b7579f8771e38fdc5a1e7 100644 --- a/ttool/src/test/java/tmltranslator/CompareTMLTests.java +++ b/ttool/src/test/java/tmltranslator/CompareTMLTests.java @@ -1,13 +1,10 @@ package tmltranslator; +import myutil.FileUtils; import test.AbstractTest; -import tmltranslator.compareTMLTest.CompareTML; -import org.junit.Before; import org.junit.Test; import java.io.File; -import java.nio.file.Files; -import java.nio.file.Paths; import static org.junit.Assert.*; @@ -27,55 +24,51 @@ public class CompareTMLTests extends AbstractTest { // Test true cases @Test public void onlyCommentAndEmptyTest () throws Exception { - CompareTML ctml = new CompareTML(); /* file 1 and file 2 * file 1 includes only empty lines * file 2 includes only comments */ - assertTrue("comparing between empty file and another file including only comment",ctml.compareTML(new File(EMPTY_FILE), + assertTrue("comparing between empty file and another file including only comment", FileUtils.compareTMLFiles(new File(EMPTY_FILE), new File(ONLY_COMMENT_1))); } @Test public void onlyCommentAndOnlyComment () throws Exception { - CompareTML ctml = new CompareTML(); /* file 2 and file 3 * file 2 and file 3 include only comments and empty lines */ - assertTrue("comparing between 2 files including only comment",ctml.compareTML(new File(ONLY_COMMENT_1), + assertTrue("comparing between 2 files including only comment", FileUtils.compareTMLFiles(new File(ONLY_COMMENT_1), new File(ONLY_COMMENT_2))); } @Test public void sameContextDifferentComment () throws Exception { - CompareTML ctml = new CompareTML(); /* file 4 and file 5 * two files includes many comments, empty lines and white spaces before and after strings (comments or context) * adding white spaces between two words */ - assertTrue("comparing between 2 files including the same context but different comment",ctml.compareTML(new File(COMMENT_AND_CONTEXT_1), + assertTrue("comparing between 2 files including the same context but different comment", FileUtils.compareTMLFiles(new File(COMMENT_AND_CONTEXT_1), new File(COMMENT_AND_CONTEXT_2))); } // Test false cases @Test public void DifferentContextSameComment () throws Exception { - CompareTML ctml = new CompareTML(); /* file 5 and file 6 * file 5 has one different line in comparison with file 6 */ - assertFalse("comparing between 2 files including the same context but different comment",ctml.compareTML(new File(COMMENT_AND_CONTEXT_2), + assertFalse("comparing between 2 files including the same context but different comment", + FileUtils.compareTMLFiles(new File(COMMENT_AND_CONTEXT_2), new File(COMMENT_AND_CONTEXT_3))); } @Test public void DifferentContextSameComment_2 () throws Exception { - CompareTML ctml = new CompareTML(); /* file 6 and file 7 * adding context in file 7 in comparison with file 6 */ assertFalse("comparing between 2 files including the same comment but different context", - ctml.compareTML(new File(COMMENT_AND_CONTEXT_3), + FileUtils.compareTMLFiles(new File(COMMENT_AND_CONTEXT_3), new File(COMMENT_AND_CONTEXT_4))); } } diff --git a/ttool/src/test/java/tmltranslator/DiplodocusSecurityTest.java b/ttool/src/test/java/tmltranslator/DiplodocusSecurityTest.java index 0e86e40178fd50b8dcb12ad529ce7746eefc78d1..4420489e555e9a8bd6a36dc222a78feda559a60a 100644 --- a/ttool/src/test/java/tmltranslator/DiplodocusSecurityTest.java +++ b/ttool/src/test/java/tmltranslator/DiplodocusSecurityTest.java @@ -86,9 +86,7 @@ public class DiplodocusSecurityTest extends AbstractTest { // Test if proverif is installed in the path TraceManager.addDev("Testing if \"proverif\" is in the PATH"); - if (!(canExecute("proverif"))) { - return; - } + assertTrue(canExecute("proverif")); for (String tab : currentTabs) { TraceManager.addDev("\n\n********** Checking the security of " + tab + " ********\n"); diff --git a/ttool/src/test/java/tmltranslator/TMLComparingMethodTest.java b/ttool/src/test/java/tmltranslator/TMLComparingMethodTest.java index 3b2440feeef29f61eec94f03ed84e170d5e96d32..3d8fd13a5eb74657b4dd216b446e4315b3acb21d 100644 --- a/ttool/src/test/java/tmltranslator/TMLComparingMethodTest.java +++ b/ttool/src/test/java/tmltranslator/TMLComparingMethodTest.java @@ -50,15 +50,13 @@ import static org.junit.Assert.*; /** * class TMLComparingMethodTest - * This class consists of the methods for testing equalSpec() and comparing lists of Hardware nodes, activity elements, etc + * This class consists of the methods for testing equalsSpec() and TMLComparingMethod lists of Hardware nodes, activity elements, etc * @version 1.0 27/09/2019 * @author Minh Hiep PHAM */ public class TMLComparingMethodTest extends AbstractTest { - private TMLComparingMethod comparing; - private HwLink hwLink1, hwLink2, hwLink3; private HwCPU hwCPU, cpu1, cpu2, cpu3, cpu4, cpu5, cpu6, cpu7, cpu8, cpu9, cpu10, cpu11, cpu12, cpu13, cpu14; @@ -135,7 +133,6 @@ public class TMLComparingMethodTest extends AbstractTest { public TMLComparingMethodTest() { super(); - comparing = new TMLComparingMethod(); } @@ -353,51 +350,51 @@ public class TMLComparingMethodTest extends AbstractTest { } private void createSecurityPatternForTestingConfigs() { - // For testing method equalSpec() in class SecurityPattern + // For testing method equalsSpec() in class SecurityPattern secuPt1 = new SecurityPattern("securityPattern1","Advanced","5","128", "100", "100", "None", "formula1", "Key1"); - // For testing method equalSpec() in class SecurityPattern + // For testing method equalsSpec() in class SecurityPattern secuPt2 = new SecurityPattern("securityPattern1","Symmetric Encryption","10","128", "100", "100", "None", "formula1", "Key1"); - // For testing method equalSpec() in class SecurityPattern + // For testing method equalsSpec() in class SecurityPattern secuPt3 = new SecurityPattern("securityPattern1","Symmetric Encryption","5","256", "100", "100", "None", "formula1", "Key1"); - // For testing method equalSpec() in class SecurityPattern + // For testing method equalsSpec() in class SecurityPattern secuPt4 = new SecurityPattern("securityPattern1","Symmetric Encryption","5","128", "200", "100", "None", "formula1", "Key1"); - // For testing method equalSpec() in class SecurityPattern + // For testing method equalsSpec() in class SecurityPattern secuPt5 = new SecurityPattern("securityPattern1","Symmetric Encryption","5","128", "100", "300", "None", "formula1", "Key1"); - // For testing method equalSpec() in class SecurityPattern + // For testing method equalsSpec() in class SecurityPattern secuPt6 = new SecurityPattern("securityPattern1","Symmetric Encryption","5","128", "100", "100", "Yes", "formula1", "Key1"); - // For testing method equalSpec() in class SecurityPattern + // For testing method equalsSpec() in class SecurityPattern secuPt7 = new SecurityPattern("securityPattern1","Symmetric Encryption","5","128", "100", "100", "None", "formula2", "Key1"); - // For testing method equalSpec() in class SecurityPattern + // For testing method equalsSpec() in class SecurityPattern secuPt8 = new SecurityPattern("securityPattern1","Symmetric Encryption","5","128", "100", "100", "None", "formula1", "Key2"); - // For testing method equalSpec() in class SecurityPattern + // For testing method equalsSpec() in class SecurityPattern secuPt9 = new SecurityPattern("securityPattern1","Symmetric Encryption","5","128", "100", "100", "None", "formula1", "Key1"); - // For testing method equalSpec() in class SecurityPattern + // For testing method equalsSpec() in class SecurityPattern secuPt10 = new SecurityPattern("securityPattern1","Symmetric Encryption","5","128", "100", "100", "None", "formula1", "Key1"); - // For testing method equalSpec() in class SecurityPattern + // For testing method equalsSpec() in class SecurityPattern secuPt11 = new SecurityPattern("DifferenceName","Symmetric Encryption","5","128", "100", "100", "None", "formula1", "Key1"); - // For testing method equalSpec() in class SecurityPattern + // For testing method equalsSpec() in class SecurityPattern secuPt12 = new SecurityPattern("securityPattern1","Symmetric Encryption","5","128", "100", "100", "None", "formula1", "Key1"); @@ -517,85 +514,85 @@ public class TMLComparingMethodTest extends AbstractTest { @Test public void Test_ComparingTwoSecurityPattern() { - assertFalse(securityPattern1.equalSpec(secuPt1)); - assertFalse(securityPattern1.equalSpec(secuPt2)); - assertFalse(securityPattern1.equalSpec(secuPt3)); - assertFalse(securityPattern1.equalSpec(secuPt4)); - assertFalse(securityPattern1.equalSpec(secuPt5)); - assertFalse(securityPattern1.equalSpec(secuPt6)); - assertFalse(securityPattern1.equalSpec(secuPt7)); - assertFalse(securityPattern1.equalSpec(secuPt8)); - //assertFalse(securityPattern1.equalSpec(secuPt9)); - assertFalse(securityPattern1.equalSpec(secuPt10)); - assertFalse(securityPattern1.equalSpec(secuPt11)); - assertTrue(securityPattern1.equalSpec(secuPt12)); + assertFalse(securityPattern1.equalsSpec(secuPt1)); + assertFalse(securityPattern1.equalsSpec(secuPt2)); + assertFalse(securityPattern1.equalsSpec(secuPt3)); + assertFalse(securityPattern1.equalsSpec(secuPt4)); + assertFalse(securityPattern1.equalsSpec(secuPt5)); + assertFalse(securityPattern1.equalsSpec(secuPt6)); + assertFalse(securityPattern1.equalsSpec(secuPt7)); + assertFalse(securityPattern1.equalsSpec(secuPt8)); + //assertFalse(securityPattern1.equalsSpec(secuPt9)); + assertFalse(securityPattern1.equalsSpec(secuPt10)); + assertFalse(securityPattern1.equalsSpec(secuPt11)); + assertTrue(securityPattern1.equalsSpec(secuPt12)); } @Test public void Test_ComparingTwosTMLTasks() { - assertFalse(tmlTask.equalSpec(tmlTask1)); - assertFalse(tmlTask.equalSpec(tmlTask2)); - assertFalse(tmlTask.equalSpec(tmlTask3)); - assertFalse(tmlTask.equalSpec(tmlTask4)); - assertFalse(tmlTask.equalSpec(tmlTask5)); - assertFalse(tmlTask.equalSpec(tmlTask6)); - assertFalse(tmlTask.equalSpec(tmlTask7)); - assertFalse(tmlTask.equalSpec(tmlTask8)); - assertFalse(tmlTask.equalSpec(tmlTask9)); - assertTrue(tmlTask.equalSpec(tmlTask10)); + assertFalse(tmlTask.equalsSpec(tmlTask1)); + assertFalse(tmlTask.equalsSpec(tmlTask2)); + assertFalse(tmlTask.equalsSpec(tmlTask3)); + assertFalse(tmlTask.equalsSpec(tmlTask4)); + assertFalse(tmlTask.equalsSpec(tmlTask5)); + assertFalse(tmlTask.equalsSpec(tmlTask6)); + assertFalse(tmlTask.equalsSpec(tmlTask7)); + assertFalse(tmlTask.equalsSpec(tmlTask8)); + assertFalse(tmlTask.equalsSpec(tmlTask9)); + assertTrue(tmlTask.equalsSpec(tmlTask10)); } @Test public void Test_ComparingTwoTMLPorts() { - assertFalse(tmlPort.equalSpec(tmlP1)); - assertFalse(tmlPort.equalSpec(tmlP2)); - assertFalse(tmlPort.equalSpec(tmlP3)); - assertFalse(tmlPort.equalSpec(tmlP4)); - assertFalse(tmlPort.equalSpec(tmlP5)); - assertTrue(tmlPort.equalSpec(tmlP6)); + assertFalse(tmlPort.equalsSpec(tmlP1)); + assertFalse(tmlPort.equalsSpec(tmlP2)); + assertFalse(tmlPort.equalsSpec(tmlP3)); + assertFalse(tmlPort.equalsSpec(tmlP4)); + assertFalse(tmlPort.equalsSpec(tmlP5)); + assertTrue(tmlPort.equalsSpec(tmlP6)); } @Test public void Test_ComparingTwoTMLRequests() { - assertFalse(tmlRequest.equalSpec(request1)); - assertFalse(tmlRequest.equalSpec(request2)); - assertFalse(tmlRequest.equalSpec(request3)); - assertFalse(tmlRequest.equalSpec(request4)); - assertFalse(tmlRequest.equalSpec(request5)); - assertFalse(tmlRequest.equalSpec(request6)); - assertFalse(tmlRequest.equalSpec(request7)); - assertTrue(tmlRequest.equalSpec(request8)); + assertFalse(tmlRequest.equalsSpec(request1)); + assertFalse(tmlRequest.equalsSpec(request2)); + assertFalse(tmlRequest.equalsSpec(request3)); + assertFalse(tmlRequest.equalsSpec(request4)); + assertFalse(tmlRequest.equalsSpec(request5)); + assertFalse(tmlRequest.equalsSpec(request6)); + assertFalse(tmlRequest.equalsSpec(request7)); + assertTrue(tmlRequest.equalsSpec(request8)); } @Test public void Test_ComparingTwoTMLEvents() { - assertFalse(tmlEvent.equalSpec(evt1)); - assertFalse(tmlEvent.equalSpec(evt2)); - assertFalse(tmlEvent.equalSpec(evt3)); - assertFalse(tmlEvent.equalSpec(evt4)); - assertFalse(tmlEvent.equalSpec(evt5)); - assertFalse(tmlEvent.equalSpec(evt6)); - assertFalse(tmlEvent.equalSpec(evt7)); - assertFalse(tmlEvent.equalSpec(evt8)); - assertTrue(tmlEvent.equalSpec(evt9)); + assertFalse(tmlEvent.equalsSpec(evt1)); + assertFalse(tmlEvent.equalsSpec(evt2)); + assertFalse(tmlEvent.equalsSpec(evt3)); + assertFalse(tmlEvent.equalsSpec(evt4)); + assertFalse(tmlEvent.equalsSpec(evt5)); + assertFalse(tmlEvent.equalsSpec(evt6)); + assertFalse(tmlEvent.equalsSpec(evt7)); + assertFalse(tmlEvent.equalsSpec(evt8)); + assertTrue(tmlEvent.equalsSpec(evt9)); } @Test public void Test_ComparingTwoTMLChannels() { - assertFalse(tmlChannel.equalSpec(chl1)); - assertFalse(tmlChannel.equalSpec(chl2)); - assertFalse(tmlChannel.equalSpec(chl3)); - assertFalse(tmlChannel.equalSpec(chl4)); - assertFalse(tmlChannel.equalSpec(chl5)); - assertFalse(tmlChannel.equalSpec(chl6)); - assertFalse(tmlChannel.equalSpec(chl7)); - assertFalse(tmlChannel.equalSpec(chl8)); - assertFalse(tmlChannel.equalSpec(chl9)); - assertFalse(tmlChannel.equalSpec(chl10)); - assertFalse(tmlChannel.equalSpec(chl11)); - assertFalse(tmlChannel.equalSpec(chl13)); - assertTrue(tmlChannel.equalSpec(chl12)); + assertFalse(tmlChannel.equalsSpec(chl1)); + assertFalse(tmlChannel.equalsSpec(chl2)); + assertFalse(tmlChannel.equalsSpec(chl3)); + assertFalse(tmlChannel.equalsSpec(chl4)); + assertFalse(tmlChannel.equalsSpec(chl5)); + assertFalse(tmlChannel.equalsSpec(chl6)); + assertFalse(tmlChannel.equalsSpec(chl7)); + assertFalse(tmlChannel.equalsSpec(chl8)); + assertFalse(tmlChannel.equalsSpec(chl9)); + assertFalse(tmlChannel.equalsSpec(chl10)); + assertFalse(tmlChannel.equalsSpec(chl11)); + assertFalse(tmlChannel.equalsSpec(chl13)); + assertTrue(tmlChannel.equalsSpec(chl12)); } @@ -744,96 +741,96 @@ public class TMLComparingMethodTest extends AbstractTest { @Test public void Test_ComparingTwoHwNoCs() { - assertFalse(hwNoC.equalSpec(noc1)); - assertFalse(hwNoC.equalSpec(noc2)); - assertFalse(hwNoC.equalSpec(noc3)); - assertFalse(hwNoC.equalSpec(noc4)); - assertFalse(hwNoC.equalSpec(noc5)); - assertTrue(hwNoC.equalSpec(noc6)); + assertFalse(hwNoC.equalsSpec(noc1)); + assertFalse(hwNoC.equalsSpec(noc2)); + assertFalse(hwNoC.equalsSpec(noc3)); + assertFalse(hwNoC.equalsSpec(noc4)); + assertFalse(hwNoC.equalsSpec(noc5)); + assertTrue(hwNoC.equalsSpec(noc6)); } @Test public void Test_ComparingTwoHwMemorys() { - assertFalse(hwMemory.equalSpec(memory1)); - assertFalse(hwMemory.equalSpec(memory2)); - assertFalse(hwMemory.equalSpec(memory3)); - assertFalse(hwMemory.equalSpec(memory4)); - assertFalse(hwMemory.equalSpec(memory5)); - assertTrue(hwMemory.equalSpec(memory6)); + assertFalse(hwMemory.equalsSpec(memory1)); + assertFalse(hwMemory.equalsSpec(memory2)); + assertFalse(hwMemory.equalsSpec(memory3)); + assertFalse(hwMemory.equalsSpec(memory4)); + assertFalse(hwMemory.equalsSpec(memory5)); + assertTrue(hwMemory.equalsSpec(memory6)); } @Test public void Test_ComparingTwoHwDMAs() { - assertFalse(hwDMA.equalSpec(dma1)); - assertFalse(hwDMA.equalSpec(dma2)); - assertFalse(hwDMA.equalSpec(dma3)); - assertFalse(hwDMA.equalSpec(dma4)); - assertTrue(hwDMA.equalSpec(dma5)); + assertFalse(hwDMA.equalsSpec(dma1)); + assertFalse(hwDMA.equalsSpec(dma2)); + assertFalse(hwDMA.equalsSpec(dma3)); + assertFalse(hwDMA.equalsSpec(dma4)); + assertTrue(hwDMA.equalsSpec(dma5)); } @Test public void Test_ComparingTwoHwBridge() { - assertFalse(hwBridge.equalSpec(bridge1)); - assertFalse(hwBridge.equalSpec(bridge2)); - assertFalse(hwBridge.equalSpec(bridge3)); - assertTrue(hwBridge.equalSpec(bridge4)); + assertFalse(hwBridge.equalsSpec(bridge1)); + assertFalse(hwBridge.equalsSpec(bridge2)); + assertFalse(hwBridge.equalsSpec(bridge3)); + assertTrue(hwBridge.equalsSpec(bridge4)); } @Test public void Test_ComparingTwoHwBus() { - assertFalse(hwBus.equalSpec(bus1)); - assertFalse(hwBus.equalSpec(bus2)); - assertFalse(hwBus.equalSpec(bus3)); - assertFalse(hwBus.equalSpec(bus4)); - assertFalse(hwBus.equalSpec(bus5)); - assertFalse(hwBus.equalSpec(bus6)); - assertFalse(hwBus.equalSpec(bus7)); - assertTrue(hwBus.equalSpec(bus8)); + assertFalse(hwBus.equalsSpec(bus1)); + assertFalse(hwBus.equalsSpec(bus2)); + assertFalse(hwBus.equalsSpec(bus3)); + assertFalse(hwBus.equalsSpec(bus4)); + assertFalse(hwBus.equalsSpec(bus5)); + assertFalse(hwBus.equalsSpec(bus6)); + assertFalse(hwBus.equalsSpec(bus7)); + assertTrue(hwBus.equalsSpec(bus8)); } @Test public void Test_ComparingTwoHwFPGA() { - assertFalse(hwFPGA.equalSpec(fpga1)); - assertFalse(hwFPGA.equalSpec(fpga2)); - assertFalse(hwFPGA.equalSpec(fpga3)); - assertFalse(hwFPGA.equalSpec(fpga4)); - assertFalse(hwFPGA.equalSpec(fpga5)); - assertFalse(hwFPGA.equalSpec(fpga6)); - assertFalse(hwFPGA.equalSpec(fpga7)); - assertFalse(hwFPGA.equalSpec(fpga8)); - assertFalse(hwFPGA.equalSpec(fpga9)); - assertFalse(hwFPGA.equalSpec(fpga10)); - assertFalse(hwFPGA.equalSpec(fpga11)); - assertFalse(hwFPGA.equalSpec(fpga12)); - assertTrue(hwFPGA.equalSpec(fpga13)); + assertFalse(hwFPGA.equalsSpec(fpga1)); + assertFalse(hwFPGA.equalsSpec(fpga2)); + assertFalse(hwFPGA.equalsSpec(fpga3)); + assertFalse(hwFPGA.equalsSpec(fpga4)); + assertFalse(hwFPGA.equalsSpec(fpga5)); + assertFalse(hwFPGA.equalsSpec(fpga6)); + assertFalse(hwFPGA.equalsSpec(fpga7)); + assertFalse(hwFPGA.equalsSpec(fpga8)); + assertFalse(hwFPGA.equalsSpec(fpga9)); + assertFalse(hwFPGA.equalsSpec(fpga10)); + assertFalse(hwFPGA.equalsSpec(fpga11)); + assertFalse(hwFPGA.equalsSpec(fpga12)); + assertTrue(hwFPGA.equalsSpec(fpga13)); } @Test public void Test_ComparingTwoHwAs() { - assertFalse(hwa.equalSpec(hwa1)); - assertFalse(hwa.equalSpec(hwa2)); - assertFalse(hwa.equalSpec(hwa3)); - assertFalse(hwa.equalSpec(hwa4)); - assertTrue(hwa.equalSpec(hwa5)); - assertFalse(hwa.equalSpec(hwa6)); + assertFalse(hwa.equalsSpec(hwa1)); + assertFalse(hwa.equalsSpec(hwa2)); + assertFalse(hwa.equalsSpec(hwa3)); + assertFalse(hwa.equalsSpec(hwa4)); + assertTrue(hwa.equalsSpec(hwa5)); + assertFalse(hwa.equalsSpec(hwa6)); } @Test public void Test_ComparingTwosHwCPUs() { - assertFalse(hwCPU.equalSpec(cpu1)); - assertFalse(hwCPU.equalSpec(cpu2)); - assertFalse(hwCPU.equalSpec(cpu3)); - assertFalse(hwCPU.equalSpec(cpu4)); - assertFalse(hwCPU.equalSpec(cpu5)); - assertFalse(hwCPU.equalSpec(cpu6)); - assertFalse(hwCPU.equalSpec(cpu7)); - assertFalse(hwCPU.equalSpec(cpu8)); - assertFalse(hwCPU.equalSpec(cpu9)); - assertFalse(hwCPU.equalSpec(cpu10)); - assertFalse(hwCPU.equalSpec(cpu11)); - assertFalse(hwCPU.equalSpec(cpu13)); - assertFalse(hwCPU.equalSpec(cpu14)); - assertTrue(hwCPU.equalSpec(cpu12)); + assertFalse(hwCPU.equalsSpec(cpu1)); + assertFalse(hwCPU.equalsSpec(cpu2)); + assertFalse(hwCPU.equalsSpec(cpu3)); + assertFalse(hwCPU.equalsSpec(cpu4)); + assertFalse(hwCPU.equalsSpec(cpu5)); + assertFalse(hwCPU.equalsSpec(cpu6)); + assertFalse(hwCPU.equalsSpec(cpu7)); + assertFalse(hwCPU.equalsSpec(cpu8)); + assertFalse(hwCPU.equalsSpec(cpu9)); + assertFalse(hwCPU.equalsSpec(cpu10)); + assertFalse(hwCPU.equalsSpec(cpu11)); + assertFalse(hwCPU.equalsSpec(cpu13)); + assertFalse(hwCPU.equalsSpec(cpu14)); + assertTrue(hwCPU.equalsSpec(cpu12)); } @@ -866,17 +863,17 @@ public class TMLComparingMethodTest extends AbstractTest { } @Test - public void isOncommondesListEquals() { + public void areOncommondesListsEqual() { assertTrue("two lists have same context but difference element order" + - "",comparing.isOncommondesListEquals(hwCommunicationNodeList1,hwCommunicationNodeList2)); + "",TMLComparingMethod.areOncommondesListsEqual(hwCommunicationNodeList1,hwCommunicationNodeList2)); assertFalse("two lists have same size but difference context" + - "",comparing.isOncommondesListEquals(hwCommunicationNodeList1,hwCommunicationNodeList3)); + "",TMLComparingMethod.areOncommondesListsEqual(hwCommunicationNodeList1,hwCommunicationNodeList3)); - assertTrue("two empty lists", comparing.isOncommondesListEquals(hwCommunicationNodeList4,hwCommunicationNodeList5)); + assertTrue("two empty lists", TMLComparingMethod.areOncommondesListsEqual(hwCommunicationNodeList4,hwCommunicationNodeList5)); - assertFalse("two lists have difference size",comparing.isOncommondesListEquals(hwCommunicationNodeList1,hwCommunicationNodeList6)); + assertFalse("two lists have difference size",TMLComparingMethod.areOncommondesListsEqual(hwCommunicationNodeList1,hwCommunicationNodeList6)); @@ -907,16 +904,16 @@ public class TMLComparingMethodTest extends AbstractTest { } @Test - public void isMappedcommeltsListEquals() { + public void areMappedcommeltsListsEqual() { assertTrue("two lists have same context but difference element order" + - "",comparing.isMappedcommeltsListEquals(tmlElementList1,tmlElementList2)); + "",TMLComparingMethod.areMappedcommeltsListsEqual(tmlElementList1,tmlElementList2)); assertFalse("two lists have same context but difference context" + - "",comparing.isMappedcommeltsListEquals(tmlElementList1,tmlElementList3)); + "",TMLComparingMethod.areMappedcommeltsListsEqual(tmlElementList1,tmlElementList3)); - assertTrue("two empty lists", comparing.isMappedcommeltsListEquals(tmlElementList4,tmlElementList5)); + assertTrue("two empty lists", TMLComparingMethod.areMappedcommeltsListsEqual(tmlElementList4,tmlElementList5)); - assertFalse("two lists have difference size",comparing.isMappedcommeltsListEquals(tmlElementList1,tmlElementList6)); + assertFalse("two lists have difference size",TMLComparingMethod.areMappedcommeltsListsEqual(tmlElementList1,tmlElementList6)); } private void createdTaskLists() { @@ -940,16 +937,16 @@ public class TMLComparingMethodTest extends AbstractTest { } @Test - public void isTasksListEquals() { + public void areTaskListsEqual() { assertTrue("two lists have same context but difference element order" + - "",comparing.isTasksListEquals(taskList1,taskList2)); + "",TMLComparingMethod.areTaskListsEqual(taskList1,taskList2)); assertFalse("two lists have same context but difference context" + - "",comparing.isTasksListEquals(taskList1,taskList3)); + "",TMLComparingMethod.areTaskListsEqual(taskList1,taskList3)); - assertTrue("two empty lists", comparing.isTasksListEquals(taskList4,taskList5)); + assertTrue("two empty lists", TMLComparingMethod.areTaskListsEqual(taskList4,taskList5)); - assertFalse("two lists have difference size",comparing.isTasksListEquals(taskList1,taskList6)); + assertFalse("two lists have difference size",TMLComparingMethod.areTaskListsEqual(taskList1,taskList6)); } @@ -975,17 +972,17 @@ public class TMLComparingMethodTest extends AbstractTest { } @Test - public void isOnExecutionNodeListEquals() { + public void areOnExecutionNodeListsEqual() { assertTrue("two lists have same context but difference element order" + - "",comparing.isOnExecutionNodeListEquals(hwExecutionNodeList1,hwExecutionNodeList2)); + "",TMLComparingMethod.areOnExecutionNodeListsEqual(hwExecutionNodeList1,hwExecutionNodeList2)); assertFalse("two lists have difference context" + - "",comparing.isOnExecutionNodeListEquals(hwExecutionNodeList1,hwExecutionNodeList3)); + "",TMLComparingMethod.areOnExecutionNodeListsEqual(hwExecutionNodeList1,hwExecutionNodeList3)); - assertTrue("two empty lists", comparing.isOnExecutionNodeListEquals(hwExecutionNodeList4,hwExecutionNodeList5)); + assertTrue("two empty lists", TMLComparingMethod.areOnExecutionNodeListsEqual(hwExecutionNodeList4,hwExecutionNodeList5)); - assertFalse("two lists have difference size",comparing.isOnExecutionNodeListEquals(hwExecutionNodeList1,hwExecutionNodeList6)); + assertFalse("two lists have difference size",TMLComparingMethod.areOnExecutionNodeListsEqual(hwExecutionNodeList1,hwExecutionNodeList6)); } private void createListOfStringArray() { @@ -1023,17 +1020,17 @@ public class TMLComparingMethodTest extends AbstractTest { } @Test - public void isListOfStringArrayEquals() { + public void areListsOfStringArrayEqual() { assertTrue("two lists have same context but difference element order" + - "",comparing.isListOfStringArrayEquals(listOfStrArray1,listOfStrArray2)); + "",TMLComparingMethod.areListsOfStringArrayEqual(listOfStrArray1,listOfStrArray2)); assertFalse("two lists have difference context" + - "",comparing.isListOfStringArrayEquals(listOfStrArray1,listOfStrArray3)); + "",TMLComparingMethod.areListsOfStringArrayEqual(listOfStrArray1,listOfStrArray3)); - assertTrue("two empty lists", comparing.isListOfStringArrayEquals(listOfStrArray4, listOfStrArray5)); + assertTrue("two empty lists", TMLComparingMethod.areListsOfStringArrayEqual(listOfStrArray4, listOfStrArray5)); - assertFalse("two lists have difference size",comparing.isListOfStringArrayEquals(listOfStrArray1,listOfStrArray6)); + assertFalse("two lists have difference size",TMLComparingMethod.areListsOfStringArrayEqual(listOfStrArray1,listOfStrArray6)); } private void createSecurityMap() { @@ -1067,13 +1064,13 @@ public class TMLComparingMethodTest extends AbstractTest { @Test public void isSecurityPatternMapEquals() { - assertFalse("two lists have same context but difference element order", comparing.isKeyMappingEquals(securityMap1,securityMap2)); + assertFalse("two lists have same context but difference element order", TMLComparingMethod.areKeysMappingEqual(securityMap1,securityMap2)); - assertFalse("two lists have same size but difference context", comparing.isKeyMappingEquals(securityMap1,securityMap3)); + assertFalse("two lists have same size but difference context", TMLComparingMethod.areKeysMappingEqual(securityMap1,securityMap3)); - assertTrue("two empty lists", comparing.isKeyMappingEquals(securityMap4,securityMap5)); + assertTrue("two empty lists", TMLComparingMethod.areKeysMappingEqual(securityMap4,securityMap5)); - assertFalse("two lists have difference size",comparing.isKeyMappingEquals(securityMap1,securityMap6)); + assertFalse("two lists have difference size",TMLComparingMethod.areKeysMappingEqual(securityMap1,securityMap6)); } @@ -1097,18 +1094,18 @@ public class TMLComparingMethodTest extends AbstractTest { } @Test - public void isHwMemoryListEquals() { + public void isHwMemoryListsEqual() { assertTrue("two lists have same context but difference element order" + - "",comparing.isHwMemoryListEquals(memoryList1,memoryList2)); + "",TMLComparingMethod.areHwMemoryListsEqual(memoryList1,memoryList2)); assertFalse("two lists have difference context" + - "",comparing.isHwMemoryListEquals(memoryList1,memoryList3)); + "",TMLComparingMethod.areHwMemoryListsEqual(memoryList1,memoryList3)); - assertTrue("two empty lists", comparing.isHwMemoryListEquals(memoryList4, memoryList5)); + assertTrue("two empty lists", TMLComparingMethod.areHwMemoryListsEqual(memoryList4, memoryList5)); - assertFalse("two lists have difference size",comparing.isHwMemoryListEquals(memoryList1,memoryList6)); + assertFalse("two lists have difference size",TMLComparingMethod.areHwMemoryListsEqual(memoryList1,memoryList6)); } private void createTMLActivityElementList() { @@ -1206,16 +1203,16 @@ public class TMLComparingMethodTest extends AbstractTest { } @Test - public void isTMLActivityEltListEquals() { + public void isTMLActivityEltListsEqual() { assertTrue("two lists have same context but difference element order" + - "",comparing.isTMLActivityEltListEquals(tmlActEltList1,tmlActEltList2)); + "",TMLComparingMethod.areTMLActivityEltListsEqual(tmlActEltList1,tmlActEltList2)); assertFalse("two lists have difference context" + - "",comparing.isTMLActivityEltListEquals(tmlActEltList1,tmlActEltList3)); + "",TMLComparingMethod.areTMLActivityEltListsEqual(tmlActEltList1,tmlActEltList3)); - assertTrue("two empty lists", comparing.isTMLActivityEltListEquals(tmlActEltList4, tmlActEltList5)); + assertTrue("two empty lists", TMLComparingMethod.areTMLActivityEltListsEqual(tmlActEltList4, tmlActEltList5)); - assertFalse("two lists have difference size",comparing.isTMLActivityEltListEquals(tmlActEltList1,tmlActEltList6)); + assertFalse("two lists have difference size",TMLComparingMethod.areTMLActivityEltListsEqual(tmlActEltList1,tmlActEltList6)); } private void createHwNodeList() { @@ -1258,17 +1255,17 @@ public class TMLComparingMethodTest extends AbstractTest { } @Test - public void isHwNodeListEquals() { + public void areHwNodeListsEqual() { assertTrue("two lists have same context but difference element order" + - "",comparing.isHwNodeListEquals(hwNodeList1,hwNodeList2)); + "",TMLComparingMethod.areHwNodeListsEqual(hwNodeList1,hwNodeList2)); assertFalse("two lists have difference context" + - "",comparing.isHwNodeListEquals(hwNodeList1,hwNodeList3)); + "",TMLComparingMethod.areHwNodeListsEqual(hwNodeList1,hwNodeList3)); - assertTrue("two empty lists", comparing.isHwNodeListEquals(hwNodeList4,hwNodeList5)); + assertTrue("two empty lists", TMLComparingMethod.areHwNodeListsEqual(hwNodeList4,hwNodeList5)); - assertFalse("two lists have difference size",comparing.isHwNodeListEquals(hwNodeList1,hwNodeList6)); + assertFalse("two lists have difference size",TMLComparingMethod.areHwNodeListsEqual(hwNodeList1,hwNodeList6)); } @@ -1302,17 +1299,17 @@ public class TMLComparingMethodTest extends AbstractTest { } @Test - public void isHwlinkListEquals() { + public void areHwlinkListsEqual() { assertTrue("two lists have same context but difference element order" + - "",comparing.isHwlinkListEquals(hwLinkList1,hwLinkList2)); + "",TMLComparingMethod.areHwlinkListsEqual(hwLinkList1,hwLinkList2)); assertFalse("two lists have difference context" + - "",comparing.isHwlinkListEquals(hwLinkList1,hwLinkList3)); + "",TMLComparingMethod.areHwlinkListsEqual(hwLinkList1,hwLinkList3)); - assertTrue("two empty lists", comparing.isHwlinkListEquals(hwLinkList4, hwLinkList5)); + assertTrue("two empty lists", TMLComparingMethod.areHwlinkListsEqual(hwLinkList4, hwLinkList5)); - assertFalse("two lists have difference size", comparing.isHwlinkListEquals(hwLinkList1, hwLinkList6)); + assertFalse("two lists have difference size", TMLComparingMethod.areHwlinkListsEqual(hwLinkList1, hwLinkList6)); } private void createdPortLists() { @@ -1335,16 +1332,16 @@ public class TMLComparingMethodTest extends AbstractTest { } @Test - public void isPortListEquals() { + public void arePortListsEqual() { assertTrue("two lists have same context but difference element order" + - "",comparing.isPortListEquals(portList1,portList2)); + "",TMLComparingMethod.arePortListsEqual(portList1,portList2)); assertFalse("two lists have difference context" + - "",comparing.isPortListEquals(portList1,portList3)); + "",TMLComparingMethod.arePortListsEqual(portList1,portList3)); - assertTrue("two empty lists", comparing.isPortListEquals(portList4, portList5)); + assertTrue("two empty lists", TMLComparingMethod.arePortListsEqual(portList4, portList5)); - assertFalse("two lists have difference size", comparing.isPortListEquals(portList1, portList6)); + assertFalse("two lists have difference size", TMLComparingMethod.arePortListsEqual(portList1, portList6)); } @@ -1368,16 +1365,16 @@ public class TMLComparingMethodTest extends AbstractTest { } @Test - public void isTMLChannelSetEquals() { + public void areTMLChannelSetsEqual() { assertTrue("two sets have same context but difference element order" + - "",comparing.isTMLChannelSetEquals(channelSet1,channelSet2)); + "",TMLComparingMethod.areTMLChannelSetsEqual(channelSet1,channelSet2)); assertFalse("two sets have difference context" + - "",comparing.isTMLChannelSetEquals(channelSet1,channelSet3)); + "",TMLComparingMethod.areTMLChannelSetsEqual(channelSet1,channelSet3)); - assertTrue("two empty sets", comparing.isTMLChannelSetEquals(channelSet4, channelSet5)); + assertTrue("two empty sets", TMLComparingMethod.areTMLChannelSetsEqual(channelSet4, channelSet5)); - assertFalse("two sets have difference size", comparing.isTMLChannelSetEquals(channelSet1, channelSet6)); + assertFalse("two sets have difference size", TMLComparingMethod.areTMLChannelSetsEqual(channelSet1, channelSet6)); } private void createEventSets() { @@ -1400,15 +1397,15 @@ public class TMLComparingMethodTest extends AbstractTest { } @Test - public void isTMLEventSetEquals() { + public void areTMLEventSetsEqual() { assertTrue("two sets have same context but difference element order" + - "",comparing.isTMLEventSetEquals(eventSet1,eventSet2)); + "", TMLComparingMethod.areTMLEventSetsEqual(eventSet1,eventSet2)); assertFalse("two sets have difference context" + - "",comparing.isTMLEventSetEquals(eventSet1,eventSet3)); + "", TMLComparingMethod.areTMLEventSetsEqual(eventSet1,eventSet3)); - assertTrue("two empty sets", comparing.isTMLEventSetEquals(eventSet4, eventSet5)); + assertTrue("two empty sets", TMLComparingMethod.areTMLEventSetsEqual(eventSet4, eventSet5)); - assertFalse("two sets have difference size", comparing.isTMLEventSetEquals(eventSet1, eventSet6)); + assertFalse("two sets have difference size", TMLComparingMethod.areTMLEventSetsEqual(eventSet1, eventSet6)); } } \ No newline at end of file diff --git a/ttool/src/test/java/tmltranslator/TMLDeepCloneTests.java b/ttool/src/test/java/tmltranslator/TMLDeepCloneTests.java index 11a8b9475a0458fe05df03395dfc844dc152426e..b1a8ecc7d1d1199c4d6f8c8abb2680e47020b63c 100644 --- a/ttool/src/test/java/tmltranslator/TMLDeepCloneTests.java +++ b/ttool/src/test/java/tmltranslator/TMLDeepCloneTests.java @@ -3,13 +3,9 @@ package tmltranslator; import myutil.FileUtils; import myutil.TraceManager; import test.AbstractTest; -import tmltranslator.compareTMLTest.CompareTML; -import org.junit.Before; import org.junit.Test; import java.io.File; -import java.nio.file.Files; -import java.nio.file.Paths; import static org.junit.Assert.*; @@ -80,7 +76,7 @@ public class TMLDeepCloneTests extends AbstractTest { assertTrue(syntax.hasErrors() == 0); // Comparing the two TML Modeling - boolean equal = cloned.equalSpec(tmlts.getTMLModeling()); + boolean equal = cloned.equalsSpec(tmlts.getTMLModeling()); assertTrue(equal); @@ -131,7 +127,7 @@ public class TMLDeepCloneTests extends AbstractTest { assertTrue(syntax.hasErrors() == 0); // Comparing the two TML Modeling - boolean equal = cloned.equalSpec(tmlts.getTMLMapping()); + boolean equal = cloned.equalsSpec(tmlts.getTMLMapping()); assertTrue(equal); diff --git a/ttool/src/test/java/ui/DiplodocusDelayPenaltyDisableTests.java b/ttool/src/test/java/ui/DiplodocusDelayPenaltyDisableTests.java index 95f44e4290af7c065ec160cf493005f0d7551cf3..bdb26af2baa089c2882d2ee484374019aac3eb07 100644 --- a/ttool/src/test/java/ui/DiplodocusDelayPenaltyDisableTests.java +++ b/ttool/src/test/java/ui/DiplodocusDelayPenaltyDisableTests.java @@ -9,18 +9,12 @@ import org.junit.BeforeClass; import org.junit.Test; import req.ebrdd.EBRDD; import tepe.TEPE; -import test.AbstractTest; import tmltranslator.TMLMapping; import tmltranslator.TMLMappingTextSpecification; import tmltranslator.TMLSyntaxChecking; -import tmltranslator.compareTMLTest.CompareTML; import tmltranslator.tomappingsystemc2.DiploSimulatorFactory; import tmltranslator.tomappingsystemc2.IDiploSimulatorCodeGenerator; import tmltranslator.tomappingsystemc2.Penalties; -import ui.AbstractUITest; -import ui.TDiagramPanel; -import ui.TMLArchiPanel; -import ui.TURTLEPanel; import ui.tmldd.TMLArchiDiagramPanel; import java.io.BufferedReader; @@ -231,7 +225,6 @@ public class DiplodocusDelayPenaltyDisableTests extends AbstractUITest { @Test public void testGenerateTML() throws Exception { - CompareTML compTML = new CompareTML(); mainGUI.openProjectFromFile(new File(RESOURCES_DIR + "delay-readwrite.xml")); for(TURTLEPanel _tab : mainGUI.getTabs()) { if(_tab instanceof TMLArchiPanel) { @@ -253,12 +246,11 @@ public class DiplodocusDelayPenaltyDisableTests extends AbstractUITest { System.out.println("\n\n\n*** Compared files: " + f1.getAbsolutePath() + " vs " + f2.getAbsolutePath() + "\n\n" + "\n"); - assertTrue(compTML.compareTML(f1,f2)); + assertTrue(FileUtils.compareTMLFiles(f1,f2)); } @Test public void testTwoConsecutiveDelay1() throws Exception { - CompareTML compTML = new CompareTML(); mainGUI.openProjectFromFile(new File(RESOURCES_DIR + "consecutive_delay1.xml")); for(TURTLEPanel _tab : mainGUI.getTabs()) { if(_tab instanceof TMLArchiPanel) { @@ -275,12 +267,11 @@ public class DiplodocusDelayPenaltyDisableTests extends AbstractUITest { mainGUI.generateTMLTxt(); File f1 = new File(EXPECTED_FILE2); File f2 = new File("spec.tml"); // Generated file after executing "TML generation" - assertTrue(compTML.compareTML(f1,f2)); + assertTrue(FileUtils.compareTMLFiles(f1,f2)); } @Test public void testTwoConsecutiveDelay2() throws Exception { - CompareTML compTML = new CompareTML(); mainGUI.openProjectFromFile(new File(RESOURCES_DIR + "consecutive_delay2.xml")); for(TURTLEPanel _tab : mainGUI.getTabs()) { if(_tab instanceof TMLArchiPanel) { @@ -297,7 +288,7 @@ public class DiplodocusDelayPenaltyDisableTests extends AbstractUITest { mainGUI.generateTMLTxt(); File f1 = new File(EXPECTED_FILE3); File f2 = new File("spec.tml"); // Generated file after executing "TML generation" - assertTrue(compTML.compareTML(f1,f2)); + assertTrue(FileUtils.compareTMLFiles(f1,f2)); } @Test diff --git a/ttool/src/test/java/ui/TDiagramPanelCloneArchitectureTest.java b/ttool/src/test/java/ui/TDiagramPanelCloneArchitectureTest.java index af79c9d97392bec02cff6f88f8168829ace3627f..6e3354c364e5c3609d0613f2a0694340d6b6d82d 100644 --- a/ttool/src/test/java/ui/TDiagramPanelCloneArchitectureTest.java +++ b/ttool/src/test/java/ui/TDiagramPanelCloneArchitectureTest.java @@ -40,7 +40,6 @@ package ui; import myutil.TraceManager; -import org.apache.batik.anim.timing.Trace; import org.junit.*; import tmltranslator.*; import translator.CheckingError; @@ -253,7 +252,7 @@ public class TDiagramPanelCloneArchitectureTest extends AbstractUITest { TraceManager.addDev("*** Comparing spec"); //assertNotNull(tmlMapping_clone); //assertNotNull(tmlMapping_exp); - assertTrue(tmlMapping_clone.equalSpec(tmlMapping_exp)); + assertTrue(tmlMapping_clone.equalsSpec(tmlMapping_exp)); } catch (Exception e) { TraceManager.addDev("Exception: " + e.getClass() + " / " + e.getMessage()); diff --git a/ttool/src/test/java/ui/TDiagramPanelCloneTest.java b/ttool/src/test/java/ui/TDiagramPanelCloneTest.java index d5565ec7868426ad4cd0d9cb46407ed1ad4ba118..376ca692aa432dc804e85c3e13e684e04da3f894 100644 --- a/ttool/src/test/java/ui/TDiagramPanelCloneTest.java +++ b/ttool/src/test/java/ui/TDiagramPanelCloneTest.java @@ -1,7 +1,7 @@ package ui; +import myutil.FileUtils; import org.junit.*; -import tmltranslator.compareTMLTest.CompareTML; import ui.tmlcompd.TMLComponentTaskDiagramPanel; @@ -70,14 +70,13 @@ public class TDiagramPanelCloneTest extends AbstractUITest { System.out.println("Not null testCloneCompositeComponentWithNullFather "); for (int i = 0; i < EXPECTED_FILES.length; i++) { System.out.println("Testing with " + components[i].getValue()); - CompareTML compTML = new CompareTML(); diagramPanel.cloneComponent(components[i]); mainGUI.checkModelingSyntax(true); mainGUI.generateTMLTxt(); File f1 = new File(FILE_DIR + EXPECTED_FILES[i]); File f2 = new File("spec.tml"); // Generated file after executing "TML generation" System.out.println("Comparing " + f1.getAbsolutePath() + " with " + f2.getAbsolutePath()); - assertTrue(compTML.compareTML(f1, f2)); + assertTrue(FileUtils.compareTMLFiles(f1, f2)); } } System.out.println("End test testCloneCompositeComponentWithNullFather ");