Consolidated validations: fixed ids and error messages + cleanup of some code smells
diff --git a/plugins/org.eclipse.app4mc.amalthea.validations.inchron/src/org/eclipse/app4mc/amalthea/validations/inchron/os/InchronOsPUAllocationMustBeDisjunct.java b/plugins/org.eclipse.app4mc.amalthea.validations.inchron/src/org/eclipse/app4mc/amalthea/validations/inchron/os/InchronOsPUAllocationMustBeDisjunct.java
index dfa8437..864ad52 100644
--- a/plugins/org.eclipse.app4mc.amalthea.validations.inchron/src/org/eclipse/app4mc/amalthea/validations/inchron/os/InchronOsPUAllocationMustBeDisjunct.java
+++ b/plugins/org.eclipse.app4mc.amalthea.validations.inchron/src/org/eclipse/app4mc/amalthea/validations/inchron/os/InchronOsPUAllocationMustBeDisjunct.java
@@ -34,7 +34,7 @@
-@Validation(id = "Inchron-Os-PU-Allocation-MustBeDisjunct",
+@Validation(id = "Inchron-OS-PU-Allocation-MustBeDisjunct",
checks = { "OS Scheduler to core mapping must be distinct"})
public class InchronOsPUAllocationMustBeDisjunct extends AmaltheaValidation {
diff --git a/plugins/org.eclipse.app4mc.amalthea.validations.inchron/src/org/eclipse/app4mc/amalthea/validations/inchron/os/InchronOsUserSpecificSchedulerCheck.java b/plugins/org.eclipse.app4mc.amalthea.validations.inchron/src/org/eclipse/app4mc/amalthea/validations/inchron/os/InchronOsUserSpecificSchedulerCheck.java
index cdcac01..082e23c 100644
--- a/plugins/org.eclipse.app4mc.amalthea.validations.inchron/src/org/eclipse/app4mc/amalthea/validations/inchron/os/InchronOsUserSpecificSchedulerCheck.java
+++ b/plugins/org.eclipse.app4mc.amalthea.validations.inchron/src/org/eclipse/app4mc/amalthea/validations/inchron/os/InchronOsUserSpecificSchedulerCheck.java
@@ -29,7 +29,7 @@
-@Validation(id = "Inchron-Os-UserSpecificSchedulerCheck",
+@Validation(id = "Inchron-OS-UserSpecificSchedulerCheck",
checks = { "User specific task scheduler needs at least one task allocation"})
public class InchronOsUserSpecificSchedulerCheck extends AmaltheaValidation {
diff --git a/plugins/org.eclipse.app4mc.amalthea.validations.sim/src/org/eclipse/app4mc/amalthea/validations/sim/hardware/SimHwConnection.java b/plugins/org.eclipse.app4mc.amalthea.validations.sim/src/org/eclipse/app4mc/amalthea/validations/sim/hardware/SimHwConnection.java
index fc9cba7..b3998c5 100644
--- a/plugins/org.eclipse.app4mc.amalthea.validations.sim/src/org/eclipse/app4mc/amalthea/validations/sim/hardware/SimHwConnection.java
+++ b/plugins/org.eclipse.app4mc.amalthea.validations.sim/src/org/eclipse/app4mc/amalthea/validations/sim/hardware/SimHwConnection.java
@@ -52,12 +52,12 @@
if (con.getReadLatency() == null && con.getDataRate() == null) {
addIssue(results, con, ePackage.getHwConnection_ReadLatency(),
- objectInfo(con) + ": Neither read latency nor datarate specified");
+ objectInfo(con) + ": Neither read/write latency nor data rate specified");
}
if (con.getWriteLatency() == null && con.getDataRate() == null) {
addIssue(results, con, ePackage.getHwConnection_WriteLatency(),
- objectInfo(con) + ": Neither read latency nor datarate specified");
+ objectInfo(con) + ": Neither read/write latency nor data rate specified");
}
}
}
diff --git a/plugins/org.eclipse.app4mc.amalthea.validations.sim/src/org/eclipse/app4mc/amalthea/validations/sim/os/SimOsSchedulerAllocation.java b/plugins/org.eclipse.app4mc.amalthea.validations.sim/src/org/eclipse/app4mc/amalthea/validations/sim/os/SimOsSchedulerAllocation.java
index 22f2a7c..2fb5c1e 100644
--- a/plugins/org.eclipse.app4mc.amalthea.validations.sim/src/org/eclipse/app4mc/amalthea/validations/sim/os/SimOsSchedulerAllocation.java
+++ b/plugins/org.eclipse.app4mc.amalthea.validations.sim/src/org/eclipse/app4mc/amalthea/validations/sim/os/SimOsSchedulerAllocation.java
@@ -34,18 +34,21 @@
*
* <ul>
* <li>Each scheduler must be linked to a processing unit. Therefore a unique
- * scheduler allocation mapping is necessary.
- * Further checks (e.g. mapping to a processing unit) are available in the
- * mapping model validations</li>
+ * scheduler allocation mapping is necessary. Further checks (e.g. mapping to a
+ * processing unit) are available in the mapping model validations</li>
* </ul>
*/
-@Validation(
- id = "Sim-OS-SchedulerAllocation",
- checks = { "Scheduler must be referred to by exactly one scheduler allocation" })
+@Validation(id = "Sim-OS-SchedulerAllocation", checks = {
+ "Scheduler must be referred to by exactly one scheduler allocation" })
public class SimOsSchedulerAllocation extends AmaltheaValidation {
+ public static final String MESSAGE_MANY_INTERRUPT_CONTROLLER_ALLOCATIONS = "ISR is referred to by more than one scheduler allocation";
+ public static final String MESSAGE_NO_INTERRUPT_CONTROLLER_ALLOCATION = "ISR is not referred to by any scheduler allocation";
+ public static final String MESSAGE_MANY_SCHEDULER_ALLOCATIONS = "Scheduler is referred to by more than one scheduler allocation";
+ public static final String MESSAGE_NO_SCHEDULER_ALLOCATION = "Scheduler is not referred to by any scheduler allocation";
+
@Override
public EClassifier getEClassifier() {
return ePackage.getScheduler();
@@ -53,47 +56,30 @@
@Override
public void validate(EObject eObject, List<ValidationDiagnostic> results) {
-
+
if (eObject instanceof InterruptController) {
InterruptController isrController = (InterruptController) eObject;
- Set<?>allocations = AmaltheaIndex.getReferringObjects(isrController).stream().filter((referer) -> referer instanceof SchedulerAllocation).collect(Collectors.toSet());
+ Set<?> allocations = AmaltheaIndex.getReferringObjects(isrController).stream()
+ .filter(SchedulerAllocation.class::isInstance).collect(Collectors.toSet());
if (allocations.isEmpty()) {
- addIssue(results, isrController, ePackage.getScheduler_SchedulerAllocations(), getMessageNoInterruptControllerAllocation());
+ addIssue(results, isrController, ePackage.getScheduler_SchedulerAllocations(),
+ MESSAGE_NO_INTERRUPT_CONTROLLER_ALLOCATION);
} else if (allocations.size() > 1) {
- addIssue(results, isrController, ePackage.getScheduler_SchedulerAllocations(), getMessageManyInterruptControllerAllocations());
+ addIssue(results, isrController, ePackage.getScheduler_SchedulerAllocations(),
+ MESSAGE_MANY_INTERRUPT_CONTROLLER_ALLOCATIONS);
}
- } else if (eObject instanceof Scheduler){ //TaskScheduler
+ } else if (eObject instanceof Scheduler) { // TaskScheduler
Scheduler scheduler = (Scheduler) eObject;
- Set<?>allocations = AmaltheaIndex.getReferringObjects(scheduler).stream().filter((referer) -> referer instanceof SchedulerAllocation).collect(Collectors.toSet());
+ Set<?> allocations = AmaltheaIndex.getReferringObjects(scheduler).stream()
+ .filter(SchedulerAllocation.class::isInstance).collect(Collectors.toSet());
if (allocations.isEmpty()) {
- addIssue(results, scheduler, ePackage.getScheduler_SchedulerAllocations(), getMessageNoSchedulerAllocation());
+ addIssue(results, scheduler, ePackage.getScheduler_SchedulerAllocations(),
+ MESSAGE_NO_SCHEDULER_ALLOCATION);
} else if (allocations.size() > 1) {
- addIssue(results, scheduler, ePackage.getScheduler_SchedulerAllocations(), getMessageManySchedulerAllocations());
+ addIssue(results, scheduler, ePackage.getScheduler_SchedulerAllocations(),
+ MESSAGE_MANY_SCHEDULER_ALLOCATIONS);
}
}
}
-
-
- public static String getMessageNoSchedulerAllocation() {
- return "Scheduler is not referred to by any scheduler allocation";
- }
-
- public static String getMessageManySchedulerAllocations() {
- return "Scheduler is referred to by more than one scheduler allocation";
- }
-
- public static String getMessageNoInterruptControllerAllocation() {
- return "ISR is not referred to by any scheduler allocation";
- }
-
- public static String getMessageManyInterruptControllerAllocations() {
- return "ISR is referred to by more than one scheduler allocation";
- }
-
-
}
-
-
-
-
diff --git a/plugins/org.eclipse.app4mc.amalthea.validations.sim/src/org/eclipse/app4mc/amalthea/validations/sim/software/SimSoftwareChannelAccessFeasibility.java b/plugins/org.eclipse.app4mc.amalthea.validations.sim/src/org/eclipse/app4mc/amalthea/validations/sim/software/SimSoftwareChannelAccessFeasibility.java
index 4fcd970..8f166df 100644
--- a/plugins/org.eclipse.app4mc.amalthea.validations.sim/src/org/eclipse/app4mc/amalthea/validations/sim/software/SimSoftwareChannelAccessFeasibility.java
+++ b/plugins/org.eclipse.app4mc.amalthea.validations.sim/src/org/eclipse/app4mc/amalthea/validations/sim/software/SimSoftwareChannelAccessFeasibility.java
@@ -37,7 +37,7 @@
@Validation(
id = "Sim-Software-ChannelAccessFeasibility",
- checks = { "Checks if a channel access can be performed from certain runnable." })
+ checks = { "Checks if a channel access can be performed from certain runnable" })
public class SimSoftwareChannelAccessFeasibility extends AmaltheaValidation {
diff --git a/plugins/org.eclipse.app4mc.amalthea.validations.sim/src/org/eclipse/app4mc/amalthea/validations/sim/software/SimSoftwareChannelElements.java b/plugins/org.eclipse.app4mc.amalthea.validations.sim/src/org/eclipse/app4mc/amalthea/validations/sim/software/SimSoftwareChannelElements.java
index 6ba59f3..c3edcae 100644
--- a/plugins/org.eclipse.app4mc.amalthea.validations.sim/src/org/eclipse/app4mc/amalthea/validations/sim/software/SimSoftwareChannelElements.java
+++ b/plugins/org.eclipse.app4mc.amalthea.validations.sim/src/org/eclipse/app4mc/amalthea/validations/sim/software/SimSoftwareChannelElements.java
@@ -33,7 +33,7 @@
*/
@Validation(
- id = "SimSoftwareChannelElements",
+ id = "Sim-Software-ChannelElements",
checks = { "Checks if channel access's property elements is greater 0" })
public class SimSoftwareChannelElements extends AmaltheaValidation {
diff --git a/plugins/org.eclipse.app4mc.amalthea.validations.sim/src/org/eclipse/app4mc/amalthea/validations/sim/software/SimSoftwareChannelMapped.java b/plugins/org.eclipse.app4mc.amalthea.validations.sim/src/org/eclipse/app4mc/amalthea/validations/sim/software/SimSoftwareChannelMapped.java
index 5850155..5f2d0ef 100644
--- a/plugins/org.eclipse.app4mc.amalthea.validations.sim/src/org/eclipse/app4mc/amalthea/validations/sim/software/SimSoftwareChannelMapped.java
+++ b/plugins/org.eclipse.app4mc.amalthea.validations.sim/src/org/eclipse/app4mc/amalthea/validations/sim/software/SimSoftwareChannelMapped.java
@@ -34,7 +34,7 @@
*/
@Validation(
- id = "SimSoftwareAbstractMemoryElementIsMapped",
+ id = "Sim-Software-AbstractMemoryElementIsMapped",
checks = { "Checks if channel is mapped to a Memory" })
public class SimSoftwareChannelMapped extends AmaltheaValidation {
diff --git a/plugins/org.eclipse.app4mc.amalthea.validations.sim/src/org/eclipse/app4mc/amalthea/validations/sim/software/SimSoftwareLabelAccessType.java b/plugins/org.eclipse.app4mc.amalthea.validations.sim/src/org/eclipse/app4mc/amalthea/validations/sim/software/SimSoftwareLabelAccessType.java
index 85c8982..0a57d1e 100644
--- a/plugins/org.eclipse.app4mc.amalthea.validations.sim/src/org/eclipse/app4mc/amalthea/validations/sim/software/SimSoftwareLabelAccessType.java
+++ b/plugins/org.eclipse.app4mc.amalthea.validations.sim/src/org/eclipse/app4mc/amalthea/validations/sim/software/SimSoftwareLabelAccessType.java
@@ -34,7 +34,7 @@
*/
@Validation(
- id = "SimSoftwareAbstractMemoryElementIsMapped",
+ id = "Sim-Software-AbstractMemoryElementIsMapped",
checks = { "Checks if label access type is set" })
public class SimSoftwareLabelAccessType extends AmaltheaValidation {
diff --git a/plugins/org.eclipse.app4mc.amalthea.validations.sim/src/org/eclipse/app4mc/amalthea/validations/sim/software/SimSoftwareLabelMapped.java b/plugins/org.eclipse.app4mc.amalthea.validations.sim/src/org/eclipse/app4mc/amalthea/validations/sim/software/SimSoftwareLabelMapped.java
index cd5293e..c4eeb92 100644
--- a/plugins/org.eclipse.app4mc.amalthea.validations.sim/src/org/eclipse/app4mc/amalthea/validations/sim/software/SimSoftwareLabelMapped.java
+++ b/plugins/org.eclipse.app4mc.amalthea.validations.sim/src/org/eclipse/app4mc/amalthea/validations/sim/software/SimSoftwareLabelMapped.java
@@ -34,7 +34,7 @@
*/
@Validation(
- id = "SimSoftwareAbstractMemoryElementIsMapped",
+ id = "Sim-Software-AbstractMemoryElementIsMapped",
checks = { "Checks if label is mapped to a memory node" })
public class SimSoftwareLabelMapped extends AmaltheaValidation {
diff --git a/plugins/org.eclipse.app4mc.amalthea.validations.sim/src/org/eclipse/app4mc/amalthea/validations/sim/software/SimSoftwareModeLabelAccessType.java b/plugins/org.eclipse.app4mc.amalthea.validations.sim/src/org/eclipse/app4mc/amalthea/validations/sim/software/SimSoftwareModeLabelAccessType.java
index ae4839e..79aa52f 100644
--- a/plugins/org.eclipse.app4mc.amalthea.validations.sim/src/org/eclipse/app4mc/amalthea/validations/sim/software/SimSoftwareModeLabelAccessType.java
+++ b/plugins/org.eclipse.app4mc.amalthea.validations.sim/src/org/eclipse/app4mc/amalthea/validations/sim/software/SimSoftwareModeLabelAccessType.java
@@ -36,7 +36,7 @@
*/
@Validation(
- id = "SimSoftwareAbstractMemoryElementIsMapped",
+ id = "Sim-Software-AbstractMemoryElementIsMapped",
checks = { "Checks if modeLabel access type is valid" })
public class SimSoftwareModeLabelAccessType extends AmaltheaValidation {
diff --git a/plugins/org.eclipse.app4mc.amalthea.validations.sim/src/org/eclipse/app4mc/amalthea/validations/sim/software/SimSoftwareModeLabelMapped.java b/plugins/org.eclipse.app4mc.amalthea.validations.sim/src/org/eclipse/app4mc/amalthea/validations/sim/software/SimSoftwareModeLabelMapped.java
index 7c66625..b4468fd 100644
--- a/plugins/org.eclipse.app4mc.amalthea.validations.sim/src/org/eclipse/app4mc/amalthea/validations/sim/software/SimSoftwareModeLabelMapped.java
+++ b/plugins/org.eclipse.app4mc.amalthea.validations.sim/src/org/eclipse/app4mc/amalthea/validations/sim/software/SimSoftwareModeLabelMapped.java
@@ -34,7 +34,7 @@
*/
@Validation(
- id = "SimSoftwareAbstractMemoryElementIsMapped",
+ id = "Sim-Software-AbstractMemoryElementIsMapped",
checks = { "Checks if modeLabel is mapped to a Memory" })
public class SimSoftwareModeLabelMapped extends AmaltheaValidation {
diff --git a/tests/org.eclipse.app4mc.amalthea.validations.sim.tests/src/org/eclipse/app4mc/amalthea/validations/sim/tests/SimOsModelTests.xtend b/tests/org.eclipse.app4mc.amalthea.validations.sim.tests/src/org/eclipse/app4mc/amalthea/validations/sim/tests/SimOsModelTests.xtend
index f4d161d..8894885 100644
--- a/tests/org.eclipse.app4mc.amalthea.validations.sim.tests/src/org/eclipse/app4mc/amalthea/validations/sim/tests/SimOsModelTests.xtend
+++ b/tests/org.eclipse.app4mc.amalthea.validations.sim.tests/src/org/eclipse/app4mc/amalthea/validations/sim/tests/SimOsModelTests.xtend
@@ -170,13 +170,13 @@
val errors = executor.results.stream.filter[it.severityLevel == Severity.ERROR].map[it.message].collect(Collectors.toList)
assertTrue(errors.size == 4)
// from missing scheduler allocation
- assertTrue(errors.contains(SimOsSchedulerAllocation.getMessageNoSchedulerAllocation()));
+ assertTrue(errors.contains(SimOsSchedulerAllocation.MESSAGE_NO_SCHEDULER_ALLOCATION));
// from double scheduler allocation
- assertTrue(errors.contains(SimOsSchedulerAllocation.getMessageManySchedulerAllocations()));
+ assertTrue(errors.contains(SimOsSchedulerAllocation.MESSAGE_MANY_SCHEDULER_ALLOCATIONS));
// from missing interrupt controller allocation
- assertTrue(errors.contains(SimOsSchedulerAllocation.getMessageNoInterruptControllerAllocation()));
+ assertTrue(errors.contains(SimOsSchedulerAllocation.MESSAGE_NO_INTERRUPT_CONTROLLER_ALLOCATION));
// from double scheduler allocation
- assertTrue(errors.contains(SimOsSchedulerAllocation.getMessageManyInterruptControllerAllocations()));
+ assertTrue(errors.contains(SimOsSchedulerAllocation.MESSAGE_MANY_INTERRUPT_CONTROLLER_ALLOCATIONS));
}
}
diff --git a/tests/org.eclipse.app4mc.amalthea.validations.sim.tests/xtend-gen/org/eclipse/app4mc/amalthea/validations/sim/tests/SimOsModelTests.java b/tests/org.eclipse.app4mc.amalthea.validations.sim.tests/xtend-gen/org/eclipse/app4mc/amalthea/validations/sim/tests/SimOsModelTests.java
index e999dbc..5db0bbd 100644
--- a/tests/org.eclipse.app4mc.amalthea.validations.sim.tests/xtend-gen/org/eclipse/app4mc/amalthea/validations/sim/tests/SimOsModelTests.java
+++ b/tests/org.eclipse.app4mc.amalthea.validations.sim.tests/xtend-gen/org/eclipse/app4mc/amalthea/validations/sim/tests/SimOsModelTests.java
@@ -256,9 +256,9 @@
int _size = errors.size();
boolean _equals = (_size == 4);
Assert.assertTrue(_equals);
- Assert.assertTrue(errors.contains(SimOsSchedulerAllocation.getMessageNoSchedulerAllocation()));
- Assert.assertTrue(errors.contains(SimOsSchedulerAllocation.getMessageManySchedulerAllocations()));
- Assert.assertTrue(errors.contains(SimOsSchedulerAllocation.getMessageNoInterruptControllerAllocation()));
- Assert.assertTrue(errors.contains(SimOsSchedulerAllocation.getMessageManyInterruptControllerAllocations()));
+ Assert.assertTrue(errors.contains(SimOsSchedulerAllocation.MESSAGE_NO_SCHEDULER_ALLOCATION));
+ Assert.assertTrue(errors.contains(SimOsSchedulerAllocation.MESSAGE_MANY_SCHEDULER_ALLOCATIONS));
+ Assert.assertTrue(errors.contains(SimOsSchedulerAllocation.MESSAGE_NO_INTERRUPT_CONTROLLER_ALLOCATION));
+ Assert.assertTrue(errors.contains(SimOsSchedulerAllocation.MESSAGE_MANY_INTERRUPT_CONTROLLER_ALLOCATIONS));
}
}