Skip to content

Commit 8b2a7fb

Browse files
committed
Update mismatching test asserts after Graphite changes
1 parent e46cf43 commit 8b2a7fb

File tree

10 files changed

+685
-23
lines changed

10 files changed

+685
-23
lines changed

languages/cloudServicesDsl/org.netapp.pcs.tests/src/org/netapp/pcs/tests/ModifyingDerivedElementsTests.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public void changeElementReferenceValue() {
5555
XtextCVOImpl cvo = (XtextCVOImpl)deployment.getPcs().get(0);
5656
SnapMirror snapMirror = replicationPolicy.getReplication_mappings().get(0);
5757
snapMirror.setSource_volume(cvo.getVolumes().get(0));
58-
assertEquals("ReplicationPolicy has the final expected mappings", "CVO_1 . volume1 <-> CVO_2 . volume22 { policy : snapshotPolicyDefault , max_transfer_rate : 55 }", replicationPolicy.getReplication_mapping());
58+
assertEquals("ReplicationPolicy has the final expected mappings", "CVO_1 . volume1 <-> CVO_2 .volume22 { policy : snapshotPolicyDefault , max_transfer_rate : 55 }", replicationPolicy.getReplication_mapping());
5959
}
6060

6161
@Test
@@ -65,7 +65,7 @@ public void changeElementLiteralValue() {
6565
assertEquals("ReplicationPolicy has the initial expected mappings", "CVO_1 . volume3 <-> CVO_2 .volume22 { policy : snapshotPolicyDefault , max_transfer_rate : 55 }", replicationPolicy.getReplication_mapping());
6666
SnapMirror snapMirror = replicationPolicy.getReplication_mappings().get(0);
6767
snapMirror.setMax_transfer_rate(1);
68-
assertEquals("ReplicationPolicy has the final expected mappings", "CVO_1 . volume3 <-> CVO_2 . volume22 { policy : snapshotPolicyDefault , max_transfer_rate : 1 }", replicationPolicy.getReplication_mapping());
68+
assertEquals("ReplicationPolicy has the final expected mappings", "CVO_1 . volume3 <-> CVO_2 .volume22 { policy : snapshotPolicyDefault , max_transfer_rate : 1 }", replicationPolicy.getReplication_mapping());
6969
}
7070

7171
@Test
@@ -75,7 +75,7 @@ public void setReferenceToNull() {
7575
assertEquals("ReplicationPolicy has the initial expected mappings", "CVO_1 . volume3 <-> CVO_2 .volume22 { policy : snapshotPolicyDefault , max_transfer_rate : 55 }", replicationPolicy.getReplication_mapping());
7676
SnapMirror snapMirror = replicationPolicy.getReplication_mappings().get(0);
7777
snapMirror.setSource_volume(null);
78-
assertEquals("ReplicationPolicy has the final expected mappings", "CVO_1 . <-> CVO_2 . volume22 { policy : snapshotPolicyDefault , max_transfer_rate : 55 }", replicationPolicy.getReplication_mapping());
78+
assertEquals("ReplicationPolicy has the final expected mappings", "CVO_1 . <-> CVO_2 .volume22 { policy : snapshotPolicyDefault , max_transfer_rate : 55 }", replicationPolicy.getReplication_mapping());
7979
}
8080

8181
@Test

languages/fuzzingTestingDsl/TestingMM.tests/src/TestingPackage/tests/ConsistencyEnforcementTests.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public void changedNameOfReference() {
5656
assertEquals("ConditionBasedActivation has the initial expected starting condition", "[ {(@collisionOccurance=2) AND {(@fuzzingOperationTimes>4) AND {(@entryToTriggerZone1<@jointExtremeR3200Link0Pos) OR (@entryToTriggerZone1=43)}}}]", conditionBasedActivation.getStartingExpression());
5757
FuzzingOperationTimesMetric fuzzingOperationTimesMetric = testingSpace.getMetrics().stream().filter(x -> x instanceof FuzzingOperationTimesMetricImpl).map(x -> (FuzzingOperationTimesMetricImpl) x).collect(Collectors.toList()).get(0);
5858
fuzzingOperationTimesMetric.setName("fuzzingOperationTimesX");
59-
assertEquals("ConditionBasedActivation has the final expected starting condition", "[ { ( @ collisionOccurance=2 ) AND { ( @ fuzzingOperationTimesX>4 ) AND { ( @ entryToTriggerZone1< @ jointExtremeR3200Link0Pos ) OR ( @ entryToTriggerZone1=43 ) } } } ]", conditionBasedActivation.getStartingExpression());
59+
assertEquals("ConditionBasedActivation has the final expected starting condition", "[ {(@collisionOccurance=2) AND {(@fuzzingOperationTimesX>4) AND {(@entryToTriggerZone1<@jointExtremeR3200Link0Pos) OR (@entryToTriggerZone1=43)}}}]", conditionBasedActivation.getStartingExpression());
6060
}
6161

6262
@Test
@@ -70,7 +70,7 @@ public void deletedReference() {
7070
} catch (EolRuntimeException e) {
7171
e.printStackTrace();
7272
}
73-
assertEquals("ConditionBasedActivation has the final expected starting condition", "[ { ( @ collisionOccurance=2 ) AND { ( @ >4 ) AND { ( @ entryToTriggerZone1< @ jointExtremeR3200Link0Pos ) OR ( @ entryToTriggerZone1=43 ) } } } ]", conditionBasedActivation.getStartingExpression());
73+
assertEquals("ConditionBasedActivation has the final expected starting condition", "[ {(@collisionOccurance=2) AND {(@>4) AND {(@entryToTriggerZone1<@jointExtremeR3200Link0Pos) OR (@entryToTriggerZone1=43)}}}]", conditionBasedActivation.getStartingExpression());
7474
}
7575

7676
@Test

languages/fuzzingTestingDsl/TestingMM.tests/src/TestingPackage/tests/ModifyingDerivedElementsTests.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public void changeElementReferenceValue() {
5959
StreamMetric collisionOccurance = testingSpace.getMetrics().stream().filter(x -> (x instanceof StreamMetric && ((StreamMetric)x).getName().equals("collisionOccurance"))).map(x -> (StreamMetric) x).collect(Collectors.toList()).get(0);
6060
ConditionVariable conditionVariable = (ConditionVariable)(((BasicCondition)(((CompositeCondition)((CompositeCondition)conditionBasedActivation.getStarting().getC()).getRight()).getLeft())).getLeft());
6161
conditionVariable.setMetric(collisionOccurance);
62-
assertEquals("ConditionBasedActivation has the final expected starting condition", "[ { ( @ collisionOccurance=2 ) AND { ( @ collisionOccurance>4 ) AND { ( @ entryToTriggerZone1< @ jointExtremeR3200Link0Pos ) OR ( @ entryToTriggerZone1=43 ) } } } ]", conditionBasedActivation.getStartingExpression());
62+
assertEquals("ConditionBasedActivation has the final expected starting condition", "[ {(@collisionOccurance=2) AND {(@collisionOccurance>4) AND {(@entryToTriggerZone1<@jointExtremeR3200Link0Pos) OR (@entryToTriggerZone1=43)}}}]", conditionBasedActivation.getStartingExpression());
6363
}
6464

6565
@Test
@@ -69,7 +69,7 @@ public void changeElementLiteralValue() {
6969
assertEquals("ConditionBasedActivation has the initial expected starting condition", "[ {(@collisionOccurance=2) AND {(@fuzzingOperationTimes>4) AND {(@entryToTriggerZone1<@jointExtremeR3200Link0Pos) OR (@entryToTriggerZone1=43)}}}]", conditionBasedActivation.getStartingExpression());
7070
ConditionInteger conditionInteger = (ConditionInteger)(((BasicCondition)(((CompositeCondition)((CompositeCondition)conditionBasedActivation.getStarting().getC()).getRight()).getLeft())).getRight());
7171
conditionInteger.setValue(5);
72-
assertEquals("ConditionBasedActivation has the final expected starting condition", "[ { ( @ collisionOccurance=2 ) AND { ( @ fuzzingOperationTimes>5 ) AND { ( @ entryToTriggerZone1< @ jointExtremeR3200Link0Pos ) OR ( @ entryToTriggerZone1=43 ) } } } ]", conditionBasedActivation.getStartingExpression());
72+
assertEquals("ConditionBasedActivation has the final expected starting condition", "[ {(@collisionOccurance=2) AND {(@fuzzingOperationTimes>5) AND {(@entryToTriggerZone1<@jointExtremeR3200Link0Pos) OR (@entryToTriggerZone1=43)}}}]", conditionBasedActivation.getStartingExpression());
7373
}
7474

7575
@Test
@@ -79,7 +79,7 @@ public void setReferenceToNull() {
7979
assertEquals("ConditionBasedActivation has the initial expected starting condition", "[ {(@collisionOccurance=2) AND {(@fuzzingOperationTimes>4) AND {(@entryToTriggerZone1<@jointExtremeR3200Link0Pos) OR (@entryToTriggerZone1=43)}}}]", conditionBasedActivation.getStartingExpression());
8080
ConditionVariable conditionVariable = (ConditionVariable)(((BasicCondition)(((CompositeCondition)((CompositeCondition)conditionBasedActivation.getStarting().getC()).getRight()).getLeft())).getLeft());
8181
conditionVariable.setMetric(null);
82-
assertEquals("ConditionBasedActivation has the final expected starting condition", "[ { ( @ collisionOccurance=2 ) AND { ( @ >4 ) AND { ( @ entryToTriggerZone1< @ jointExtremeR3200Link0Pos ) OR ( @ entryToTriggerZone1=43 ) } } } ]", conditionBasedActivation.getStartingExpression());
82+
assertEquals("ConditionBasedActivation has the final expected starting condition", "[ {(@collisionOccurance=2) AND {(@>4) AND {(@entryToTriggerZone1<@jointExtremeR3200Link0Pos) OR (@entryToTriggerZone1=43)}}}]", conditionBasedActivation.getStartingExpression());
8383
}
8484

8585
@Test
@@ -93,7 +93,7 @@ public void deleteConditionElement() {
9393
} catch (EolRuntimeException e) {
9494
e.printStackTrace();
9595
}
96-
assertEquals("ConditionBasedActivation has the final expected starting condition", "[ { ( @ collisionOccurance=2 ) AND { ( @ fuzzingOperationTimes> ) AND { ( @ entryToTriggerZone1< @ jointExtremeR3200Link0Pos ) OR ( @ entryToTriggerZone1=43 ) } } } ]", conditionBasedActivation.getStartingExpression());
96+
assertEquals("ConditionBasedActivation has the final expected starting condition", "[ {(@collisionOccurance=2) AND {(@fuzzingOperationTimes> ) AND {(@entryToTriggerZone1<@jointExtremeR3200Link0Pos) OR (@entryToTriggerZone1=43)}}}]", conditionBasedActivation.getStartingExpression());
9797
}
9898

9999
@Test
@@ -107,7 +107,7 @@ public void deleteBasicCondition() {
107107
} catch (EolRuntimeException e) {
108108
e.printStackTrace();
109109
}
110-
assertEquals("ConditionBasedActivation has the final expected starting condition", "[ { ( @ collisionOccurance=2 ) AND { AND { ( @ entryToTriggerZone1< @ jointExtremeR3200Link0Pos ) OR ( @ entryToTriggerZone1=43 ) } } } ]", conditionBasedActivation.getStartingExpression());
110+
assertEquals("ConditionBasedActivation has the final expected starting condition", "[ {(@collisionOccurance=2) AND { AND {(@entryToTriggerZone1<@jointExtremeR3200Link0Pos) OR (@entryToTriggerZone1=43)}}}]", conditionBasedActivation.getStartingExpression());
111111
}
112112

113113
@Test
@@ -121,7 +121,7 @@ public void deleteCompositeCondition() {
121121
} catch (EolRuntimeException e) {
122122
e.printStackTrace();
123123
}
124-
assertEquals("ConditionBasedActivation has the final expected starting condition", "[ { ( @ collisionOccurance=2 ) AND } ]", conditionBasedActivation.getStartingExpression());
124+
assertEquals("ConditionBasedActivation has the final expected starting condition", "[ {(@collisionOccurance=2) AND } ]", conditionBasedActivation.getStartingExpression());
125125
}
126126

127127
@Test

languages/fuzzingTestingDsl/TestingMM/model/TestingMM.aird

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:description="http://www.eclipse.org/sirius/description/1.1.0" xmlns:description_1="http://www.eclipse.org/sirius/diagram/description/1.1.0" xmlns:diagram="http://www.eclipse.org/sirius/diagram/1.1.0" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" xmlns:notation="http://www.eclipse.org/gmf/runtime/1.0.3/notation" xmlns:viewpoint="http://www.eclipse.org/sirius/1.1.0" xsi:schemaLocation="http://www.eclipse.org/sirius/description/1.1.0 http://www.eclipse.org/sirius/1.1.0#//description http://www.eclipse.org/sirius/diagram/description/1.1.0 http://www.eclipse.org/sirius/diagram/1.1.0#//description">
33
<viewpoint:DAnalysis uid="_0wztwDVbEe6yocflbdX83w" selectedViews="_0zBUQDVbEe6yocflbdX83w _00GSUDVbEe6yocflbdX83w" version="15.0.0.202209061200">
44
<semanticResources>TestingMM.ecore</semanticResources>
5-
<semanticResources>TestingMM_backup.genmodel</semanticResources>
65
<semanticResources>TestingMM.genmodel</semanticResources>
76
<ownedViews xmi:type="viewpoint:DView" uid="_0zBUQDVbEe6yocflbdX83w">
87
<viewpoint xmi:type="description:Viewpoint" href="platform:/plugin/org.eclipse.sirius.sample.ecore.design/description/ecore.odesign#//@ownedViewpoints[name='Design']"/>
Lines changed: 194 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,194 @@
1+
package workload.evaluation;
2+
3+
import java.io.File;
4+
import java.util.ArrayList;
5+
import java.util.List;
6+
7+
import org.eclipse.emf.common.util.URI;
8+
import org.eclipse.emf.ecore.resource.Resource;
9+
import org.eclipse.emf.ecore.resource.ResourceSet;
10+
import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
11+
import org.eclipse.emf.ecore.util.EcoreUtil;
12+
import org.junit.Before;
13+
import org.junit.Test;
14+
15+
import graphite.textual.XtextXMIResourceFactoryImpl;
16+
import workload.Person;
17+
import workload.Project;
18+
import workload.WorkloadPackage;
19+
20+
public class ConsistencyExecutionTime {
21+
22+
@Before
23+
public void setup() throws Exception {
24+
WorkloadPackage.eINSTANCE.eClass();
25+
}
26+
27+
@Test
28+
public void renameReferenceExecutionTime() {
29+
30+
List<Long> renameReferenceDurations = new ArrayList<Long>();
31+
32+
for (int i = 0; i < EvaluationData.NumberOfModels; i++) {
33+
34+
List<Long> modelDurations = new ArrayList<Long>();
35+
36+
for (int j = 0; j < EvaluationData.Iterations; j++) {
37+
38+
try {
39+
File file = new File(EvaluationData.GeneratedModelsDirectory + EvaluationData.ModelFileName + (i+1) + "." + EvaluationData.ModelExtension);
40+
URI uri = URI.createFileURI(file.getAbsolutePath());
41+
ResourceSet resourceSet = new ResourceSetImpl();
42+
resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put(EvaluationData.ModelExtension, new XtextXMIResourceFactoryImpl());
43+
Resource resource = resourceSet.createResource(uri);
44+
resource.load(null);
45+
46+
Project project = (Project)resource.getContents().get(0);
47+
Person alice = project.getPeople().get(0);
48+
49+
long startTime = System.nanoTime();
50+
51+
alice.setName("AliceX");
52+
53+
long endTime = System.nanoTime();
54+
long duration = endTime - startTime;
55+
56+
modelDurations.add(duration);
57+
58+
resource.unload();
59+
}
60+
catch (Exception e) {
61+
e.printStackTrace();
62+
}
63+
64+
}
65+
66+
long averageModelDuration = modelDurations.stream().mapToLong(Long::longValue).sum() / (modelDurations.isEmpty() ? 1 : modelDurations.size());
67+
68+
renameReferenceDurations.add(averageModelDuration);
69+
70+
System.out.println("RenameReferenceX Duration [" + (i+1) + "]: " + String.format("%.5f", (renameReferenceDurations.get(i) / 1_000_000_000.0)));
71+
}
72+
73+
for (int i = 0; i < renameReferenceDurations.size(); i++) {
74+
System.out.println("RenameReference Duration [" + (i+1) + "]: " + String.format("%.5f", (renameReferenceDurations.get(i) / 1_000_000_000.0)));
75+
}
76+
77+
}
78+
79+
@Test
80+
public void deleteReferenceExecutionTime() {
81+
82+
List<Long> deleteReferenceDurations = new ArrayList<Long>();
83+
84+
for (int i = 0; i < EvaluationData.NumberOfModels; i++) {
85+
86+
List<Long> modelDurations = new ArrayList<Long>();
87+
88+
for (int j = 0; j < EvaluationData.Iterations; j++) {
89+
90+
try {
91+
File file = new File(EvaluationData.GeneratedModelsDirectory + EvaluationData.ModelFileName + (i+1) + "." + EvaluationData.ModelExtension);
92+
URI uri = URI.createFileURI(file.getAbsolutePath());
93+
ResourceSet resourceSet = new ResourceSetImpl();
94+
resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put(EvaluationData.ModelExtension, new XtextXMIResourceFactoryImpl());
95+
Resource resource = resourceSet.createResource(uri);
96+
resource.load(null);
97+
98+
Project project = (Project)resource.getContents().get(0);
99+
Person alice = project.getPeople().get(0);
100+
101+
long startTime = System.nanoTime();
102+
103+
EcoreUtil.delete(alice);
104+
105+
long endTime = System.nanoTime();
106+
long duration = endTime - startTime;
107+
108+
modelDurations.add(duration);
109+
110+
resource.unload();
111+
}
112+
catch (Exception e) {
113+
e.printStackTrace();
114+
}
115+
116+
}
117+
118+
long averageModelDuration = modelDurations.stream().mapToLong(Long::longValue).sum() / (modelDurations.isEmpty() ? 1 : modelDurations.size());
119+
120+
deleteReferenceDurations.add(averageModelDuration);
121+
122+
System.out.println("DeleteReferenceX Duration [" + (i+1) + "]: " + String.format("%.5f", (deleteReferenceDurations.get(i) / 1_000_000_000.0)));
123+
124+
}
125+
126+
for (int i = 0; i < deleteReferenceDurations.size(); i++) {
127+
System.out.println("DeleteReference Duration [" + (i+1) + "]: " + String.format("%.5f", (deleteReferenceDurations.get(i) / 1_000_000_000.0)));
128+
}
129+
130+
}
131+
132+
@Test
133+
public void deleteReferenceLargestModel() {
134+
135+
try {
136+
File file = new File(EvaluationData.GeneratedModelsDirectory + EvaluationData.ModelFileName + 5 + "." + EvaluationData.ModelExtension);
137+
URI uri = URI.createFileURI(file.getAbsolutePath());
138+
ResourceSet resourceSet = new ResourceSetImpl();
139+
resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put(EvaluationData.ModelExtension, new XtextXMIResourceFactoryImpl());
140+
Resource resource = resourceSet.createResource(uri);
141+
resource.load(null);
142+
143+
Project project = (Project)resource.getContents().get(0);
144+
Person alice = project.getPeople().get(0);
145+
146+
long startTime = System.nanoTime();
147+
148+
EcoreUtil.delete(alice);
149+
150+
long endTime = System.nanoTime();
151+
long duration = endTime - startTime;
152+
153+
System.out.println("DeleteReference Duration: " + String.format("%.5f", (duration / 1_000_000_000.0)));
154+
155+
resource.unload();
156+
}
157+
catch (Exception e) {
158+
e.printStackTrace();
159+
}
160+
161+
}
162+
163+
@Test
164+
public void renameReferenceLargestModel() {
165+
166+
try {
167+
File file = new File(EvaluationData.GeneratedModelsDirectory + EvaluationData.ModelFileName + 1 + "." + EvaluationData.ModelExtension);
168+
URI uri = URI.createFileURI(file.getAbsolutePath());
169+
ResourceSet resourceSet = new ResourceSetImpl();
170+
resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put(EvaluationData.ModelExtension, new XtextXMIResourceFactoryImpl());
171+
Resource resource = resourceSet.createResource(uri);
172+
resource.load(null);
173+
174+
Project project = (Project)resource.getContents().get(0);
175+
Person alice = project.getPeople().get(0);
176+
177+
long startTime = System.nanoTime();
178+
179+
alice.setName("AliceX");
180+
181+
long endTime = System.nanoTime();
182+
long duration = endTime - startTime;
183+
184+
System.out.println("RenameReference Duration: " + String.format("%.5f", (duration / 1_000_000_000.0)));
185+
186+
resource.unload();
187+
}
188+
catch (Exception e) {
189+
e.printStackTrace();
190+
}
191+
192+
}
193+
194+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
package workload.evaluation;
2+
3+
public class EvaluationData {
4+
5+
public static int NumberOfModels = 10;
6+
public static int NumberOfTasks = 500;
7+
public static int TimesEfforts = 10;
8+
public static int Iterations = 1;
9+
public static String GeneratedModelsDirectory = "generated_models/";
10+
public static String ModelFileName = "model";
11+
public static String ModelExtension = "workload";
12+
13+
}

0 commit comments

Comments
 (0)