Bug 563666 - [Sonar] Ensured compliance with naming conventions, use of String constants, ...
diff --git a/plugins/org.eclipse.app4mc.amalthea.converters.071/src/org/eclipse/app4mc/amalthea/converters071/impl/HwConverter.java b/plugins/org.eclipse.app4mc.amalthea.converters.071/src/org/eclipse/app4mc/amalthea/converters071/impl/HwConverter.java index 604e2c6..66dd3b9 100644 --- a/plugins/org.eclipse.app4mc.amalthea.converters.071/src/org/eclipse/app4mc/amalthea/converters071/impl/HwConverter.java +++ b/plugins/org.eclipse.app4mc.amalthea.converters.071/src/org/eclipse/app4mc/amalthea/converters071/impl/HwConverter.java
@@ -23,7 +23,7 @@ import org.eclipse.app4mc.amalthea.converters.common.base.ICache; import org.eclipse.app4mc.amalthea.converters.common.base.IConverter; import org.eclipse.app4mc.amalthea.converters.common.converter.AbstractConverter; -import org.eclipse.app4mc.amalthea.converters071.utils.HelperUtils_070_071; +import org.eclipse.app4mc.amalthea.converters071.utils.HelperUtils071; import org.eclipse.app4mc.util.sessionlog.SessionLogger; import org.jdom2.Document; import org.jdom2.Element; @@ -62,9 +62,9 @@ /*- Migration of size attribute of MemoryType to DataSize element */ - HelperUtils_070_071.updateMemoryTypeSize(rootElement, "./hwModel/memoryTypes"); + HelperUtils071.updateMemoryTypeSize(rootElement, "./hwModel/memoryTypes"); /*- Migration of frequency attribute of Quartz to Frequency element */ - HelperUtils_070_071.updateQuartzFrequency(rootElement, "./hwModel/system//quartzes[@frequency]"); + HelperUtils071.updateQuartzFrequency(rootElement, "./hwModel/system//quartzes[@frequency]"); } }
diff --git a/plugins/org.eclipse.app4mc.amalthea.converters.071/src/org/eclipse/app4mc/amalthea/converters071/impl/PropertyConstraintsConverter.java b/plugins/org.eclipse.app4mc.amalthea.converters.071/src/org/eclipse/app4mc/amalthea/converters071/impl/PropertyConstraintsConverter.java index c78363a..ee5c588 100644 --- a/plugins/org.eclipse.app4mc.amalthea.converters.071/src/org/eclipse/app4mc/amalthea/converters071/impl/PropertyConstraintsConverter.java +++ b/plugins/org.eclipse.app4mc.amalthea.converters.071/src/org/eclipse/app4mc/amalthea/converters071/impl/PropertyConstraintsConverter.java
@@ -23,7 +23,7 @@ import org.eclipse.app4mc.amalthea.converters.common.base.ICache; import org.eclipse.app4mc.amalthea.converters.common.base.IConverter; import org.eclipse.app4mc.amalthea.converters.common.converter.AbstractConverter; -import org.eclipse.app4mc.amalthea.converters071.utils.HelperUtils_070_071; +import org.eclipse.app4mc.amalthea.converters071.utils.HelperUtils071; import org.eclipse.app4mc.util.sessionlog.SessionLogger; import org.jdom2.Document; import org.jdom2.Element; @@ -63,11 +63,11 @@ /*- Migration of size attribute of MemoryType to DataSize element */ - HelperUtils_070_071.updateMemoryTypeSize(rootElement, "./propertyConstraintsModel/memoryTypeDefinitions"); + HelperUtils071.updateMemoryTypeSize(rootElement, "./propertyConstraintsModel/memoryTypeDefinitions"); /*- Migration of frequency attribute of Quartz to Frequency element */ - HelperUtils_070_071.updateQuartzFrequency(rootElement, + HelperUtils071.updateQuartzFrequency(rootElement, "./propertyConstraintsModel/mappingConstraints/hwConstraint//quartzes[@frequency]"); }
diff --git a/plugins/org.eclipse.app4mc.amalthea.converters.071/src/org/eclipse/app4mc/amalthea/converters071/utils/HelperUtils_070_071.java b/plugins/org.eclipse.app4mc.amalthea.converters.071/src/org/eclipse/app4mc/amalthea/converters071/utils/HelperUtils071.java similarity index 98% rename from plugins/org.eclipse.app4mc.amalthea.converters.071/src/org/eclipse/app4mc/amalthea/converters071/utils/HelperUtils_070_071.java rename to plugins/org.eclipse.app4mc.amalthea.converters.071/src/org/eclipse/app4mc/amalthea/converters071/utils/HelperUtils071.java index 76d4e46..5f2bf81 100644 --- a/plugins/org.eclipse.app4mc.amalthea.converters.071/src/org/eclipse/app4mc/amalthea/converters071/utils/HelperUtils_070_071.java +++ b/plugins/org.eclipse.app4mc.amalthea.converters.071/src/org/eclipse/app4mc/amalthea/converters071/utils/HelperUtils071.java
@@ -23,14 +23,14 @@ import org.jdom2.Attribute; import org.jdom2.Element; -public final class HelperUtils_070_071 { +public final class HelperUtils071 { private static final String AM = "am"; private static final String VALUE = "value"; private static final String SIZE = "size"; private static final String FREQUENCY = "frequency"; - private HelperUtils_070_071() { + private HelperUtils071() { // empty default constructor }
diff --git a/plugins/org.eclipse.app4mc.amalthea.converters.071/src/org/eclipse/app4mc/amalthea/converters071/utils/SectionRunnableLabelCacheBuilder.java b/plugins/org.eclipse.app4mc.amalthea.converters.071/src/org/eclipse/app4mc/amalthea/converters071/utils/SectionRunnableLabelCacheBuilder.java index 8ed4ed4..ac52373 100644 --- a/plugins/org.eclipse.app4mc.amalthea.converters.071/src/org/eclipse/app4mc/amalthea/converters071/utils/SectionRunnableLabelCacheBuilder.java +++ b/plugins/org.eclipse.app4mc.amalthea.converters.071/src/org/eclipse/app4mc/amalthea/converters071/utils/SectionRunnableLabelCacheBuilder.java
@@ -71,24 +71,24 @@ map.put(targetFile, fileCache); } - HashMap<String, List<String>> label_Sections_Map = new HashMap<>(); - fileCache.put(SectionRunnableLabelCacheEnum.LABEL_SECTIONS.name(), label_Sections_Map); + HashMap<String, List<String>> labelToSectionsMap = new HashMap<>(); + fileCache.put(SectionRunnableLabelCacheEnum.LABEL_SECTIONS.name(), labelToSectionsMap); - HashMap<String, List<String>> runnable_Sections_Map = new HashMap<>(); - fileCache.put(SectionRunnableLabelCacheEnum.RUNNABLE_SECTIONS.name(), runnable_Sections_Map); + HashMap<String, List<String>> runnableToSectionsMap = new HashMap<>(); + fileCache.put(SectionRunnableLabelCacheEnum.RUNNABLE_SECTIONS.name(), runnableToSectionsMap); - ArrayList<String> section_Names = new ArrayList<>(); - fileCache.put(SectionRunnableLabelCacheEnum.SECTION_NAMES.name(), section_Names); + ArrayList<String> sectionNames = new ArrayList<>(); + fileCache.put(SectionRunnableLabelCacheEnum.SECTION_NAMES.name(), sectionNames); /*- * Note: Below two cache elements are used to support the models which are migrated from version 1.0.3/1.1.0 to the higher versions */ - HashMap<String, List<String>> labelUUID_Sections = new HashMap<>(); - fileCache.put(SectionRunnableLabelCacheEnum.LABEL_UUID_SECTIONS.name(), labelUUID_Sections); + HashMap<String, List<String>> labelUUIDToSectionsMap = new HashMap<>(); + fileCache.put(SectionRunnableLabelCacheEnum.LABEL_UUID_SECTIONS.name(), labelUUIDToSectionsMap); - HashMap<String, List<String>> runnableUUID_Sections = new HashMap<>(); - fileCache.put(SectionRunnableLabelCacheEnum.RUNNABLE_UUID_SECTIONS.name(), runnableUUID_Sections); + HashMap<String, List<String>> runnableUUIDToSectionsMap = new HashMap<>(); + fileCache.put(SectionRunnableLabelCacheEnum.RUNNABLE_UUID_SECTIONS.name(), runnableUUIDToSectionsMap); /*- End : Cache initialization */ @@ -102,35 +102,35 @@ final String sectionName = sectionElement.getAttributeValue("name"); /*-adding section name in the cache */ - section_Names.add(sectionName); + sectionNames.add(sectionName); final Attribute labelsAttribute = sectionElement.getAttribute("labels"); if (labelsAttribute != null) { - extractMemoryElementSectionInfo(label_Sections_Map, sectionName, labelsAttribute, - labelUUID_Sections); + extractMemoryElementSectionInfo(labelToSectionsMap, sectionName, labelsAttribute, + labelUUIDToSectionsMap); } final Attribute runEntitiesAttribute = sectionElement.getAttribute("runEntities"); if (runEntitiesAttribute != null) { - extractMemoryElementSectionInfo(runnable_Sections_Map, sectionName, runEntitiesAttribute, - runnableUUID_Sections); + extractMemoryElementSectionInfo(runnableToSectionsMap, sectionName, runEntitiesAttribute, + runnableUUIDToSectionsMap); } final List<Element> labelElements = sectionElement.getChildren("labels"); for (final Element element : labelElements) { - extractMemoryElementSectionInfo(label_Sections_Map, sectionName, element, labelUUID_Sections); + extractMemoryElementSectionInfo(labelToSectionsMap, sectionName, element, labelUUIDToSectionsMap); } final List<Element> runnableElements = sectionElement.getChildren("runEntities"); for (final Element element : runnableElements) { - extractMemoryElementSectionInfo(runnable_Sections_Map, sectionName, element, - runnableUUID_Sections); + extractMemoryElementSectionInfo(runnableToSectionsMap, sectionName, element, + runnableUUIDToSectionsMap); } } @@ -141,7 +141,7 @@ * This method is used to populate the Label/Runnable name (i.e. MemoryElement name) and the corresponding Section * names to which they are associated to * - * @param memoryElement_Sections_Map + * @param memoryElementToSectionsMap * this map is part of the cache. Depending on type of the MemoryElement i.e. either Label or Runnable, * corresponding map is supplied to this method * @param sectionName @@ -154,7 +154,7 @@ * Example: <sections name="section6" labels="label6?type=Label" runEntities="Runnable7?type=Runnable"/> * @param memMElementUUIDtoSectionsMap */ - private void extractMemoryElementSectionInfo(final Map<String, List<String>> memoryElement_Sections_Map, + private void extractMemoryElementSectionInfo(final Map<String, List<String>> memoryElementToSectionsMap, final String sectionName, final Attribute memoryElementAttribute, final Map<String, List<String>> memMElementUUIDtoSectionsMap) { final String memoryElementAttributeValue = memoryElementAttribute.getValue(); @@ -168,7 +168,7 @@ if (lastIndexOf != -1) { final String memoryElementName = memoryElementReferenceString.substring(0, lastIndexOf); - addEntry(memoryElement_Sections_Map, memoryElementName, sectionName); + addEntry(memoryElementToSectionsMap, memoryElementName, sectionName); } else { /*- @@ -188,7 +188,7 @@ * This method is used to populate the Label/Runnable name (i.e. MemoryElement name) and the corresponding Section * names to which they are associated to * - * @param memoryElement_Sections_Map + * @param memoryElementToSectionsMap * this map is part of the cache. Depending on type of the MemoryElement i.e. either Label or Runnable, * corresponding map is supplied to this method * @param sectionName @@ -209,7 +209,7 @@ * </sections><br> * @param memMElementUUID_Sections */ - private void extractMemoryElementSectionInfo(final Map<String, List<String>> memoryElement_Sections_Map, + private void extractMemoryElementSectionInfo(final Map<String, List<String>> memoryElementToSectionsMap, final String sectionName, final Element memoryElement, final Map<String, List<String>> memElementUUIDtoSectionsMap) { @@ -225,7 +225,7 @@ final String memroyElementName = memoryElementAttributeValue.substring(indexOfHash + 1, indexOfQuestionmark); - addEntry(memoryElement_Sections_Map, memroyElementName, sectionName); + addEntry(memoryElementToSectionsMap, memroyElementName, sectionName); } else if (indexOfHash != -1) { /*-
diff --git a/plugins/org.eclipse.app4mc.amalthea.converters.072/src/org/eclipse/app4mc/amalthea/converters072/impl/PropertyConstraintsConverter.java b/plugins/org.eclipse.app4mc.amalthea.converters.072/src/org/eclipse/app4mc/amalthea/converters072/impl/PropertyConstraintsConverter.java index 9fb0b20..b4d8c8d 100644 --- a/plugins/org.eclipse.app4mc.amalthea.converters.072/src/org/eclipse/app4mc/amalthea/converters072/impl/PropertyConstraintsConverter.java +++ b/plugins/org.eclipse.app4mc.amalthea.converters.072/src/org/eclipse/app4mc/amalthea/converters072/impl/PropertyConstraintsConverter.java
@@ -144,31 +144,27 @@ /*- removing the CoreType objects from the PropertyConstraints model */ propertyConstraintsModel.removeContent(coreTypeDefinition); + /*- Below code is used to check if the CoreType element definition is available in the HW Model*/ - if (coreTypeName != null) { + if (coreTypeName != null && !isHWElementPresentInCache(HwElementsCacheEnum.CORE_TYPE_NAMES, coreTypeName)) { - /*- Below code is used to check if the CoreType element definition is available in the HW Model*/ - - if (!isHWElementPresentInCache(HwElementsCacheEnum.CORE_TYPE_NAMES, coreTypeName)) { - - Entry<File, Element> entry = getFirstOccuranceOfHwModelFromModelFiles(); - if (entry != null) { - - File fileAssociatedToHwElement = entry.getKey(); - Element hwModelElement = entry.getValue(); - - /*- renaming the xml tag name from coreTypeDefinitions to coreTypes -> as it will associated to HW Model */ - coreTypeDefinition.setName("coreTypes"); - /*- associating coreTypes to HW Model */ - hwModelElement.addContent(coreTypeDefinition); - - /*-newly added coreType elements are updated in the cache */ - - List<String> coreTypeNames = (List<String>) this.cache.getCacheMap() - .get(fileAssociatedToHwElement).get(HwElementsCacheEnum.CORE_TYPE_NAMES.name()); - - coreTypeNames.add(coreTypeName); - } + Entry<File, Element> entry = getFirstOccuranceOfHwModelFromModelFiles(); + if (entry != null) { + + File fileAssociatedToHwElement = entry.getKey(); + Element hwModelElement = entry.getValue(); + + /*- renaming the xml tag name from coreTypeDefinitions to coreTypes -> as it will associated to HW Model */ + coreTypeDefinition.setName("coreTypes"); + /*- associating coreTypes to HW Model */ + hwModelElement.addContent(coreTypeDefinition); + + /*-newly added coreType elements are updated in the cache */ + + List<String> coreTypeNames = (List<String>) this.cache.getCacheMap() + .get(fileAssociatedToHwElement).get(HwElementsCacheEnum.CORE_TYPE_NAMES.name()); + + coreTypeNames.add(coreTypeName); } } } @@ -189,29 +185,26 @@ /*- removing the MemoryType objects from the PropertyConstraints model */ propertyConstraintsModel.removeContent(memoryTypeDefinition); - if (memoryTypeName != null) { + /*- Below code is used to check if the MemoryType element definition is available in the HW Model*/ - /*- Below code is used to check if the MemoryType element definition is available in the HW Model*/ + if (memoryTypeName != null && !isHWElementPresentInCache(HwElementsCacheEnum.MEMORY_TYPE_NAMES, memoryTypeName)) { - if (!isHWElementPresentInCache(HwElementsCacheEnum.MEMORY_TYPE_NAMES, memoryTypeName)) { - - Entry<File, Element> entry = getFirstOccuranceOfHwModelFromModelFiles(); - if (entry != null) { - File fileAssociatedToHwElement = entry.getKey(); - Element hwModelElement = entry.getValue(); - - /*- renaming the xml tag name from memoryTypeDefinitions to memoryTypes -> as it will associated to HW Model */ - memoryTypeDefinition.setName("memoryTypes"); - /*- associating coreTypes to HW Model */ - hwModelElement.addContent(memoryTypeDefinition); - - /*-newly added memorType elements are updated in the cache */ - - List<String> memoryTypeNames = (List<String>) this.cache.getCacheMap() - .get(fileAssociatedToHwElement).get(HwElementsCacheEnum.MEMORY_TYPE_NAMES.name()); - - memoryTypeNames.add(memoryTypeName); - } + Entry<File, Element> entry = getFirstOccuranceOfHwModelFromModelFiles(); + if (entry != null) { + File fileAssociatedToHwElement = entry.getKey(); + Element hwModelElement = entry.getValue(); + + /*- renaming the xml tag name from memoryTypeDefinitions to memoryTypes -> as it will associated to HW Model */ + memoryTypeDefinition.setName("memoryTypes"); + /*- associating coreTypes to HW Model */ + hwModelElement.addContent(memoryTypeDefinition); + + /*-newly added memorType elements are updated in the cache */ + + List<String> memoryTypeNames = (List<String>) this.cache.getCacheMap() + .get(fileAssociatedToHwElement).get(HwElementsCacheEnum.MEMORY_TYPE_NAMES.name()); + + memoryTypeNames.add(memoryTypeName); } } @@ -543,10 +536,8 @@ final Object object = map.get(type.name()); - if (object instanceof List) { - if (((List<String>) object).contains(hwElementName)) { - return true; - } + if (object instanceof List && ((List<String>) object).contains(hwElementName)) { + return true; } } @@ -606,11 +597,8 @@ final Object object = map.get(elementsType.name()); - if (object instanceof List) { - if (((List<String>) object).contains(elementName)) { - return true; - } - + if (object instanceof List && ((List<String>) object).contains(elementName)) { + return true; } }
diff --git a/plugins/org.eclipse.app4mc.amalthea.converters.081/src/org/eclipse/app4mc/amalthea/converters081/impl/ConstraintsConverter.java b/plugins/org.eclipse.app4mc.amalthea.converters.081/src/org/eclipse/app4mc/amalthea/converters081/impl/ConstraintsConverter.java index c6082d0..1b0a05b 100644 --- a/plugins/org.eclipse.app4mc.amalthea.converters.081/src/org/eclipse/app4mc/amalthea/converters081/impl/ConstraintsConverter.java +++ b/plugins/org.eclipse.app4mc.amalthea.converters.081/src/org/eclipse/app4mc/amalthea/converters081/impl/ConstraintsConverter.java
@@ -90,7 +90,7 @@ } final Element rootElement = root.getRootElement(); - updateEventChainElementDefinitions_and_references(rootElement); + updateEventChainElementDefinitionsAndReferences(rootElement); } /** @@ -100,7 +100,7 @@ * @param rootElement * Amalthea root element */ - private void updateEventChainElementDefinitions_and_references(final Element rootElement) { + private void updateEventChainElementDefinitionsAndReferences(final Element rootElement) { final List<Element> rootEventChainElements = HelperUtil.getXpathResult( rootElement, "./constraintsModel/eventChains", @@ -131,7 +131,7 @@ } } - updateEventChainReferences_in_TimingConstraints(allRootEventChainElements, rootElement); + updateEventChainReferencesInTimingConstraints(allRootEventChainElements, rootElement); } /** @@ -150,7 +150,7 @@ * Amalthea root element * */ - private void updateEventChainReferences_in_TimingConstraints(final List<String> allRootEventChainElements, final Element rootElement) { + private void updateEventChainReferencesInTimingConstraints(final List<String> allRootEventChainElements, final Element rootElement) { final List<Element> eventChainReferenceEleemnts = HelperUtil.getXpathResult( rootElement, @@ -184,7 +184,7 @@ if (refEventChainStrings.trim().length() == 0) { timingConstraint.removeAttribute(eventChainsAttribute); } - logEventChainMessage_TimingConstraint(timingConstraint, refEventChainName); + logEventChainMessageTimingConstraint(timingConstraint, refEventChainName); } } @@ -215,7 +215,7 @@ /*- this is the case child EventChain element is referred (Note: As per AMALTHEA 0.8.1, it is not supported)*/ timingConstraint.removeContent(eventChainElement); invalidEventChainRefs.add(hrefValue); - logEventChainMessage_TimingConstraint(timingConstraint, refEventChainName); + logEventChainMessageTimingConstraint(timingConstraint, refEventChainName); } } } @@ -292,7 +292,7 @@ eventChainReferenceElement.removeAttribute(eventChainReferenceAttribute); - logEventChainMessage_and_Create_CustomProperty(rootEventChainElement, + logEventChainMessageAndCreateCustomProperty(rootEventChainElement, eventChainReferenceElement, refEventChainString, refEventChainName); } } @@ -333,7 +333,7 @@ eventChainReferenceElement.removeContent(eventChainElement); - logEventChainMessage_and_Create_CustomProperty(rootEventChainElement, + logEventChainMessageAndCreateCustomProperty(rootEventChainElement, eventChainReferenceElement, hrefValue, refEventChainName); } } @@ -341,7 +341,7 @@ } } - private void logEventChainMessage_TimingConstraint(final Element timingConstraintElement, + private void logEventChainMessageTimingConstraint(final Element timingConstraintElement, final String refEventChainName) { logger.warn("Sub EventChain : {0} is referred inside TimingConstraint as \"Scope\": {1}. " @@ -352,7 +352,7 @@ refEventChainName); } - private void logEventChainMessage_and_Create_CustomProperty(final Element rootEventChainElement, + private void logEventChainMessageAndCreateCustomProperty(final Element rootEventChainElement, final Element eventChainReferenceElement, final String refEventChainString, final String refEventChainName) {
diff --git a/plugins/org.eclipse.app4mc.amalthea.converters.081/src/org/eclipse/app4mc/amalthea/converters081/impl/MappingConverter.java b/plugins/org.eclipse.app4mc.amalthea.converters.081/src/org/eclipse/app4mc/amalthea/converters081/impl/MappingConverter.java index 9d7126f..b00a1cf 100644 --- a/plugins/org.eclipse.app4mc.amalthea.converters.081/src/org/eclipse/app4mc/amalthea/converters081/impl/MappingConverter.java +++ b/plugins/org.eclipse.app4mc.amalthea.converters.081/src/org/eclipse/app4mc/amalthea/converters081/impl/MappingConverter.java
@@ -69,9 +69,9 @@ } final Element rootElement = root.getRootElement(); - updateMappingModel_coreAllocation(rootElement); + updateCoreAllocation(rootElement); - updateMappingModel_schedulerAllocation(rootElement); + updateSchedulerAllocation(rootElement); } /** @@ -82,7 +82,7 @@ * @param rootElement * Amalthea root element */ - private void updateMappingModel_schedulerAllocation(Element rootElement) { + private void updateSchedulerAllocation(Element rootElement) { final StringBuilder xpathBuffer = new StringBuilder(); @@ -134,7 +134,7 @@ * @param rootElement * Amalthea root element */ - private void updateMappingModel_coreAllocation(Element rootElement) { + private void updateCoreAllocation(Element rootElement) { final StringBuilder xpathBuffer = new StringBuilder(); xpathBuffer.append("./mappingModel/coreAllocation");
diff --git a/plugins/org.eclipse.app4mc.amalthea.converters.081/src/org/eclipse/app4mc/amalthea/converters081/impl/OSConverter.java b/plugins/org.eclipse.app4mc.amalthea.converters.081/src/org/eclipse/app4mc/amalthea/converters081/impl/OSConverter.java index 0ba6f3e..71c05fc 100644 --- a/plugins/org.eclipse.app4mc.amalthea.converters.081/src/org/eclipse/app4mc/amalthea/converters081/impl/OSConverter.java +++ b/plugins/org.eclipse.app4mc.amalthea.converters.081/src/org/eclipse/app4mc/amalthea/converters081/impl/OSConverter.java
@@ -25,7 +25,7 @@ import org.eclipse.app4mc.amalthea.converters.common.converter.AbstractConverter; import org.eclipse.app4mc.amalthea.converters.common.utils.AmaltheaNamespaceRegistry; import org.eclipse.app4mc.amalthea.converters.common.utils.HelperUtil; -import org.eclipse.app4mc.amalthea.converters081.utils.HelperUtils_080_081; +import org.eclipse.app4mc.amalthea.converters081.utils.HelperUtils081; import org.eclipse.app4mc.util.sessionlog.SessionLogger; import org.jdom2.Attribute; import org.jdom2.Document; @@ -48,6 +48,12 @@ public class OSConverter extends AbstractConverter { + private static final String KEY = "key"; + private static final String VALUE = "value"; + private static final String TYPE = "type"; + private static final String CUSTOM_PROPERTIES = "customProperties"; + private static final String SCHEDULE_UNIT_PRIORITY = "scheduleUnitPriority"; + @Reference SessionLogger logger; @@ -118,14 +124,14 @@ //Adding customProperty "scheduleUnitPriority" - String scheduleUnitPriority= schedulerElement.getAttributeValue("scheduleUnitPriority"); + String scheduleUnitPriority= schedulerElement.getAttributeValue(SCHEDULE_UNIT_PRIORITY); if(scheduleUnitPriority!=null && !scheduleUnitPriority.equals("0")){ - HelperUtils_080_081.addCustomProperty(schedulerElement, "scheduleUnitPriority", schedulerElement.getAttributeValue("scheduleUnitPriority")); + HelperUtils081.addCustomProperty(schedulerElement, SCHEDULE_UNIT_PRIORITY, schedulerElement.getAttributeValue(SCHEDULE_UNIT_PRIORITY)); } //removal of scheduleUnitPriority attribute - schedulerElement.removeAttribute("scheduleUnitPriority"); + schedulerElement.removeAttribute(SCHEDULE_UNIT_PRIORITY); Element schedulingUnitElement = schedulerElement.getChild("schedulingUnit"); @@ -133,7 +139,7 @@ logger.warn("SchedulingUnit removed from Scheduler : {0}", schedulerElement.getAttributeValue("name")); - String schedulingUnitType = schedulingUnitElement.getAttributeValue("type", AmaltheaNamespaceRegistry.getGenericNamespace("xsi")); + String schedulingUnitType = schedulingUnitElement.getAttributeValue(TYPE, AmaltheaNamespaceRegistry.getGenericNamespace("xsi")); if(schedulingUnitType !=null){ @@ -146,13 +152,13 @@ if(delayElement!=null){ delayElement.detach(); - Element customPropertiesElement=new Element("customProperties"); + Element customPropertiesElement=new Element(CUSTOM_PROPERTIES); - customPropertiesElement.setAttribute("key", "SchedulingHWUnit___delay"); + customPropertiesElement.setAttribute(KEY, "SchedulingHWUnit___delay"); - delayElement.setName("value"); + delayElement.setName(VALUE); - delayElement.setAttribute("type", "am:TimeObject", AmaltheaNamespaceRegistry.getGenericNamespace("xsi")); + delayElement.setAttribute(TYPE, "am:TimeObject", AmaltheaNamespaceRegistry.getGenericNamespace("xsi")); //adding as a value to CustomProperty customPropertiesElement.addContent(delayElement); @@ -160,7 +166,7 @@ //adding customProperty to Scheduler Eleemnt schedulerElement.addContent(customPropertiesElement); - HelperUtils_080_081.addCustomProperty(schedulerElement, "SchedulingHWUnit___delay", schedulerElement.getAttributeValue("delay")); + HelperUtils081.addCustomProperty(schedulerElement, "SchedulingHWUnit___delay", schedulerElement.getAttributeValue("delay")); } @@ -183,7 +189,7 @@ Element computationItemElement=new Element("computationItems"); - computationItemElement.setAttribute("type", "am:RunnableInstructions", AmaltheaNamespaceRegistry.getGenericNamespace("xsi")); + computationItemElement.setAttribute(TYPE, "am:RunnableInstructions", AmaltheaNamespaceRegistry.getGenericNamespace("xsi")); computationItemElement.addContent(clone); @@ -196,7 +202,7 @@ String priority=schedulingUnitElement.getAttributeValue("priority"); if (priority != null && !priority.equals("0")) { - HelperUtils_080_081.addCustomProperty(schedulerElement, "SchedulingSWUnit___priority", priority); + HelperUtils081.addCustomProperty(schedulerElement, "SchedulingSWUnit___priority", priority); } // removing interruptController @@ -215,13 +221,13 @@ private void moveCustomPropertiesOfSchedulingUnit(Element schedulerElement, Element schedulingUnitElement, String prefix) { - List<Element> customPropertyElements = schedulingUnitElement.getChildren("customProperties"); + List<Element> customPropertyElements = schedulingUnitElement.getChildren(CUSTOM_PROPERTIES); for (Element customProperty : customPropertyElements) { Element cloneCustomProperty = customProperty.clone(); - Attribute keyAttribute = cloneCustomProperty.getAttribute("key"); + Attribute keyAttribute = cloneCustomProperty.getAttribute(KEY); if(keyAttribute !=null){ String value = keyAttribute.getValue();
diff --git a/plugins/org.eclipse.app4mc.amalthea.converters.081/src/org/eclipse/app4mc/amalthea/converters081/impl/SwConverter.java b/plugins/org.eclipse.app4mc.amalthea.converters.081/src/org/eclipse/app4mc/amalthea/converters081/impl/SwConverter.java index 57f5cca..634a3fc 100644 --- a/plugins/org.eclipse.app4mc.amalthea.converters.081/src/org/eclipse/app4mc/amalthea/converters081/impl/SwConverter.java +++ b/plugins/org.eclipse.app4mc.amalthea.converters.081/src/org/eclipse/app4mc/amalthea/converters081/impl/SwConverter.java
@@ -25,7 +25,7 @@ import org.eclipse.app4mc.amalthea.converters.common.converter.AbstractConverter; import org.eclipse.app4mc.amalthea.converters.common.utils.AmaltheaNamespaceRegistry; import org.eclipse.app4mc.amalthea.converters.common.utils.HelperUtil; -import org.eclipse.app4mc.amalthea.converters081.utils.HelperUtils_080_081; +import org.eclipse.app4mc.amalthea.converters081.utils.HelperUtils081; import org.eclipse.app4mc.util.sessionlog.SessionLogger; import org.jdom2.Attribute; import org.jdom2.Document; @@ -155,7 +155,7 @@ abstractProcessElement.removeAttribute(osekTaskGroupAttribute); if(!osekTaskGroupValue.equals("0")){ - HelperUtils_080_081.addCustomProperty(abstractProcessElement, "osekTaskGroup", osekTaskGroupValue); + HelperUtils081.addCustomProperty(abstractProcessElement, "osekTaskGroup", osekTaskGroupValue); logger.info("osekTaskGroup attribute is removed from Task ({0}) and added as a CustomProperty with key as osekTaskGroup", abstractProcessElement.getAttributeValue(NAME));
diff --git a/plugins/org.eclipse.app4mc.amalthea.converters.081/src/org/eclipse/app4mc/amalthea/converters081/utils/HelperUtils_080_081.java b/plugins/org.eclipse.app4mc.amalthea.converters.081/src/org/eclipse/app4mc/amalthea/converters081/utils/HelperUtils081.java similarity index 95% rename from plugins/org.eclipse.app4mc.amalthea.converters.081/src/org/eclipse/app4mc/amalthea/converters081/utils/HelperUtils_080_081.java rename to plugins/org.eclipse.app4mc.amalthea.converters.081/src/org/eclipse/app4mc/amalthea/converters081/utils/HelperUtils081.java index 092b886..87c0b44 100644 --- a/plugins/org.eclipse.app4mc.amalthea.converters.081/src/org/eclipse/app4mc/amalthea/converters081/utils/HelperUtils_080_081.java +++ b/plugins/org.eclipse.app4mc.amalthea.converters.081/src/org/eclipse/app4mc/amalthea/converters081/utils/HelperUtils081.java
@@ -18,9 +18,9 @@ import org.eclipse.app4mc.amalthea.converters.common.utils.AmaltheaNamespaceRegistry; import org.jdom2.Element; -public final class HelperUtils_080_081 { +public final class HelperUtils081 { - private HelperUtils_080_081() { + private HelperUtils081() { // empty default constructor }
diff --git a/plugins/org.eclipse.app4mc.amalthea.converters.083/src/org/eclipse/app4mc/amalthea/converters083/impl/SwConverter.java b/plugins/org.eclipse.app4mc.amalthea.converters.083/src/org/eclipse/app4mc/amalthea/converters083/impl/SwConverter.java index 78b639e..235fc65 100644 --- a/plugins/org.eclipse.app4mc.amalthea.converters.083/src/org/eclipse/app4mc/amalthea/converters083/impl/SwConverter.java +++ b/plugins/org.eclipse.app4mc.amalthea.converters.083/src/org/eclipse/app4mc/amalthea/converters083/impl/SwConverter.java
@@ -85,7 +85,7 @@ migrateVariableRateActivationElements(rootElement); - update_CustomProps_InterfacePort_Refs(rootElement); + updateCustomPropsInterfacePortRefs(rootElement); } /** @@ -271,7 +271,7 @@ } } - private void update_CustomProps_InterfacePort_Refs(Element rootElement) { + private void updateCustomPropsInterfacePortRefs(Element rootElement) { final StringBuilder xpathBuffer = new StringBuilder(); xpathBuffer.append(".//customProperties/value[@xsi:type=\"am:FInterfacePort\"]");
diff --git a/plugins/org.eclipse.app4mc.amalthea.converters.090/src/org/eclipse/app4mc/amalthea/converters090/impl/HwReferencesConverter.java b/plugins/org.eclipse.app4mc.amalthea.converters.090/src/org/eclipse/app4mc/amalthea/converters090/impl/HwReferencesConverter.java index d80e8a5..de0ec37 100644 --- a/plugins/org.eclipse.app4mc.amalthea.converters.090/src/org/eclipse/app4mc/amalthea/converters090/impl/HwReferencesConverter.java +++ b/plugins/org.eclipse.app4mc.amalthea.converters.090/src/org/eclipse/app4mc/amalthea/converters090/impl/HwReferencesConverter.java
@@ -147,13 +147,10 @@ Element.class, AmaltheaNamespaceRegistry.getGenericNamespace(XSI)); - if (! runnableInstructionsEntries.isEmpty()) { - // in this case, HWFeatureCategory should be referenced in the newly created - // ExecutionNeed elements. + // in this case, HWFeatureCategory should be referenced in the newly created ExecutionNeed elements. - if (!hwTransformationCache.getNewFeatureCategoriesMap().containsKey(INSTRUCTIONS)) { - checkAndCreateHWFeatureCategory(rootElement); - } + if (! runnableInstructionsEntries.isEmpty() && !hwTransformationCache.getNewFeatureCategoriesMap().containsKey(INSTRUCTIONS)) { + checkAndCreateHWFeatureCategory(rootElement); } for (Element runnableInstruction : runnableInstructionsEntries) {
diff --git a/plugins/org.eclipse.app4mc.amalthea.converters.090/src/org/eclipse/app4mc/amalthea/converters090/utils/UpdateCustomPropsPostProcessor.java b/plugins/org.eclipse.app4mc.amalthea.converters.090/src/org/eclipse/app4mc/amalthea/converters090/utils/UpdateCustomPropsPostProcessor.java index aacca1c..e8d40e8 100644 --- a/plugins/org.eclipse.app4mc.amalthea.converters.090/src/org/eclipse/app4mc/amalthea/converters090/utils/UpdateCustomPropsPostProcessor.java +++ b/plugins/org.eclipse.app4mc.amalthea.converters.090/src/org/eclipse/app4mc/amalthea/converters090/utils/UpdateCustomPropsPostProcessor.java
@@ -29,6 +29,7 @@ import org.eclipse.app4mc.util.sessionlog.SessionLogger; import org.jdom2.Document; import org.jdom2.Element; +import org.jdom2.Namespace; import org.osgi.service.component.annotations.Component; import org.osgi.service.component.annotations.Reference; @@ -39,11 +40,12 @@ private static final String CORE = "Core"; private static final String MEMORY = "Memory"; - private static final String XSI = "xsi"; private static final String VALUE = "value"; private static final String AMLT_PREFIX = "amlt:/#"; private static final String HW_STRUCTURE = "HwStructure"; + private static final Namespace XSI_NAMESPACE = AmaltheaNamespaceRegistry.getGenericNamespace("xsi"); + @Reference SessionLogger logger; @@ -57,29 +59,28 @@ logger.info("Start UpdateCustomPropsPostProcessor from 0.8.3 to 0.9.0"); } - List<String> hwTypes_083 = initializeHwTypesList(); + List<String> hwTypes083 = initializeHwTypesList(); Collection<Document> values = filename2documentMap.values(); for (Document document : values) { Element rootElement = document.getRootElement(); - final List<Element> value_customPropertyElements = HelperUtil.getXpathResult(rootElement, - ".//customProperties//*[@xsi:type=\"am:ReferenceObject\"]", Element.class, - AmaltheaNamespaceRegistry.getGenericNamespace(XSI)); + final List<Element> customPropertyValueElementList = HelperUtil.getXpathResult(rootElement, + ".//customProperties//*[@xsi:type=\"am:ReferenceObject\"]", Element.class, XSI_NAMESPACE); - for (Element value_customPropertyElement : value_customPropertyElements) { + for (Element customPropertyValueElement : customPropertyValueElementList) { Entry<String, String> entry = HelperUtil.getSingleElementsNameandTypeFromAttributeOrChildeElement(VALUE, - value_customPropertyElement); + customPropertyValueElement); // As the scope of updating references in CustomProperties object is limited to // HWModel : Below condition ensures that the type of the element is part of // HWModel in 0.8.3 - if (entry != null && hwTypes_083.contains(entry.getValue())) { + if (entry != null && hwTypes083.contains(entry.getValue())) { - value_customPropertyElement.removeAttribute(VALUE); - value_customPropertyElement.removeChild(VALUE); + customPropertyValueElement.removeAttribute(VALUE); + customPropertyValueElement.removeChild(VALUE); String updatedTypeAfterMigration = getUpdatedType(entry.getKey(), entry.getValue()); @@ -89,15 +90,14 @@ if (values.size() > 1) { Element valueElement = new Element(VALUE); - valueElement.setAttribute("type", "am:" + updatedTypeAfterMigration, - AmaltheaNamespaceRegistry.getGenericNamespace(XSI)); + valueElement.setAttribute("type", "am:" + updatedTypeAfterMigration, XSI_NAMESPACE); valueElement.setAttribute("href", AMLT_PREFIX + entry.getKey() + "?type=" + updatedTypeAfterMigration); - value_customPropertyElement.addContent(valueElement); + customPropertyValueElement.addContent(valueElement); } else { - value_customPropertyElement.setAttribute(VALUE, + customPropertyValueElement.setAttribute(VALUE, entry.getKey() + "?type=" + updatedTypeAfterMigration); } }
diff --git a/plugins/org.eclipse.app4mc.amalthea.converters.093/src/org/eclipse/app4mc/amalthea/converters093/impl/HwConverter.java b/plugins/org.eclipse.app4mc.amalthea.converters.093/src/org/eclipse/app4mc/amalthea/converters093/impl/HwConverter.java index e3f3bf7..596628f 100644 --- a/plugins/org.eclipse.app4mc.amalthea.converters.093/src/org/eclipse/app4mc/amalthea/converters093/impl/HwConverter.java +++ b/plugins/org.eclipse.app4mc.amalthea.converters.093/src/org/eclipse/app4mc/amalthea/converters093/impl/HwConverter.java
@@ -26,7 +26,7 @@ import org.eclipse.app4mc.amalthea.converters.common.utils.AmaltheaNamespaceRegistry; import org.eclipse.app4mc.amalthea.converters.common.utils.HelperUtil; import org.eclipse.app4mc.amalthea.converters.common.utils.ModelVersion; -import org.eclipse.app4mc.amalthea.converters093.utils.HelperUtils_092_093; +import org.eclipse.app4mc.amalthea.converters093.utils.HelperUtils093; import org.eclipse.app4mc.util.sessionlog.SessionLogger; import org.jdom2.Attribute; import org.jdom2.Document; @@ -117,7 +117,7 @@ int indexOf = parentElement.indexOf(latencyElement); - Element migratedElement = HelperUtils_092_093.migrateDeviationElementContainingLongValue( + Element migratedElement = HelperUtils093.migrateDeviationElementContainingLongValue( latencyElement.getChild("cycles"), elementName, 1.0, logger); parentElement.removeContent(latencyElement);
diff --git a/plugins/org.eclipse.app4mc.amalthea.converters.093/src/org/eclipse/app4mc/amalthea/converters093/impl/MeasurementConverter.java b/plugins/org.eclipse.app4mc.amalthea.converters.093/src/org/eclipse/app4mc/amalthea/converters093/impl/MeasurementConverter.java index 07f2760..319cefe 100644 --- a/plugins/org.eclipse.app4mc.amalthea.converters.093/src/org/eclipse/app4mc/amalthea/converters093/impl/MeasurementConverter.java +++ b/plugins/org.eclipse.app4mc.amalthea.converters.093/src/org/eclipse/app4mc/amalthea/converters093/impl/MeasurementConverter.java
@@ -26,7 +26,7 @@ import org.eclipse.app4mc.amalthea.converters.common.utils.AmaltheaNamespaceRegistry; import org.eclipse.app4mc.amalthea.converters.common.utils.HelperUtil; import org.eclipse.app4mc.amalthea.converters.common.utils.ModelVersion; -import org.eclipse.app4mc.amalthea.converters093.utils.HelperUtils_092_093; +import org.eclipse.app4mc.amalthea.converters093.utils.HelperUtils093; import org.eclipse.app4mc.util.sessionlog.SessionLogger; import org.jdom2.Document; import org.jdom2.Element; @@ -76,7 +76,7 @@ Element runtimeDeviationElement = measurementElement.getChild("runtimeDeviation"); if (runtimeDeviationElement != null) { - Element migratedElement = HelperUtils_092_093.migrateDeviationElementContainingTimeValue( + Element migratedElement = HelperUtils093.migrateDeviationElementContainingTimeValue( runtimeDeviationElement, "runtimeDeviation", logger); int indexOf = measurementElement.indexOf(runtimeDeviationElement); measurementElement.removeContent(runtimeDeviationElement);
diff --git a/plugins/org.eclipse.app4mc.amalthea.converters.093/src/org/eclipse/app4mc/amalthea/converters093/impl/OsConverter.java b/plugins/org.eclipse.app4mc.amalthea.converters.093/src/org/eclipse/app4mc/amalthea/converters093/impl/OsConverter.java index 59c81b0..69d136c 100644 --- a/plugins/org.eclipse.app4mc.amalthea.converters.093/src/org/eclipse/app4mc/amalthea/converters093/impl/OsConverter.java +++ b/plugins/org.eclipse.app4mc.amalthea.converters.093/src/org/eclipse/app4mc/amalthea/converters093/impl/OsConverter.java
@@ -26,7 +26,7 @@ import org.eclipse.app4mc.amalthea.converters.common.utils.AmaltheaNamespaceRegistry; import org.eclipse.app4mc.amalthea.converters.common.utils.HelperUtil; import org.eclipse.app4mc.amalthea.converters.common.utils.ModelVersion; -import org.eclipse.app4mc.amalthea.converters093.utils.HelperUtils_092_093; +import org.eclipse.app4mc.amalthea.converters093.utils.HelperUtils093; import org.eclipse.app4mc.util.sessionlog.SessionLogger; import org.jdom2.Attribute; import org.jdom2.Document; @@ -202,7 +202,7 @@ if(deviationElement !=null) { - Element migratedElement= HelperUtils_092_093.migrateDeviationElementContainingLongValue(deviationElement, "default", 1.0, logger); + Element migratedElement= HelperUtils093.migrateDeviationElementContainingLongValue(deviationElement, "default", 1.0, logger); osInstructionsSubElement.removeContent(deviationElement);
diff --git a/plugins/org.eclipse.app4mc.amalthea.converters.093/src/org/eclipse/app4mc/amalthea/converters093/impl/StimulusConverter.java b/plugins/org.eclipse.app4mc.amalthea.converters.093/src/org/eclipse/app4mc/amalthea/converters093/impl/StimulusConverter.java index 6ef4a16..2087597 100644 --- a/plugins/org.eclipse.app4mc.amalthea.converters.093/src/org/eclipse/app4mc/amalthea/converters093/impl/StimulusConverter.java +++ b/plugins/org.eclipse.app4mc.amalthea.converters.093/src/org/eclipse/app4mc/amalthea/converters093/impl/StimulusConverter.java
@@ -26,7 +26,7 @@ import org.eclipse.app4mc.amalthea.converters.common.utils.AmaltheaNamespaceRegistry; import org.eclipse.app4mc.amalthea.converters.common.utils.HelperUtil; import org.eclipse.app4mc.amalthea.converters.common.utils.ModelVersion; -import org.eclipse.app4mc.amalthea.converters093.utils.HelperUtils_092_093; +import org.eclipse.app4mc.amalthea.converters093.utils.HelperUtils093; import org.eclipse.app4mc.util.sessionlog.SessionLogger; import org.jdom2.Document; import org.jdom2.Element; @@ -34,12 +34,8 @@ import org.osgi.service.component.annotations.Component; import org.osgi.service.component.annotations.Reference; -@Component( - property = { - ServiceConstants.INPUT_MODEL_VERSION_PROPERTY + "=0.9.2", - ServiceConstants.OUTPUT_MODEL_VERSION_PROPERTY + "=0.9.3" - }, - service = IConverter.class) +@Component(property = { ServiceConstants.INPUT_MODEL_VERSION_PROPERTY + "=0.9.2", + ServiceConstants.OUTPUT_MODEL_VERSION_PROPERTY + "=0.9.3" }, service = IConverter.class) public class StimulusConverter extends AbstractConverter { @Reference @@ -54,11 +50,12 @@ @Override public void convert(File targetFile, Map<File, Document> filename2documentMap, List<ICache> caches) { - logger.info( - "Migration from 0.9.2 to 0.9.3 : Executing Stimulus converter for model file : {0}", targetFile.getName()); + logger.info("Migration from 0.9.2 to 0.9.3 : Executing Stimulus converter for model file : {0}", + targetFile.getName()); final Document root = filename2documentMap.get(targetFile); - if (root == null) return; + if (root == null) + return; final Element rootElement = root.getRootElement(); updateStimuli(rootElement); @@ -81,15 +78,16 @@ if (stimuliType != null) { if (stimuliType.equals("am:PeriodicStimulus")) { - Element jitter_time_deviationElement = stimuliElement.getChild("jitter"); + Element jitterDeviationElement = stimuliElement.getChild("jitter"); - if (jitter_time_deviationElement != null) { + if (jitterDeviationElement != null) { - Element migratedElement = HelperUtils_092_093.migrateDeviationElementContainingTimeValue(jitter_time_deviationElement, "jitter", logger); + Element migratedElement = HelperUtils093 + .migrateDeviationElementContainingTimeValue(jitterDeviationElement, "jitter", logger); - int indexOf = stimuliElement.indexOf(jitter_time_deviationElement); + int indexOf = stimuliElement.indexOf(jitterDeviationElement); - stimuliElement.removeContent(jitter_time_deviationElement); + stimuliElement.removeContent(jitterDeviationElement); if (migratedElement != null) { // adding migrated element to the stimuli element @@ -99,39 +97,39 @@ } else if (stimuliType.equals("am:RelativePeriodicStimulus")) { - Element nextOccurrence_time_deviationElement = stimuliElement.getChild("nextOccurrence"); + Element nextOccurrenceDeviationElement = stimuliElement.getChild("nextOccurrence"); - if (nextOccurrence_time_deviationElement != null) { + if (nextOccurrenceDeviationElement != null) { - Element migratedElement = HelperUtils_092_093.migrateDeviationElementContainingTimeValue(nextOccurrence_time_deviationElement, "nextOccurrence", logger); + Element migratedElement = HelperUtils093.migrateDeviationElementContainingTimeValue( + nextOccurrenceDeviationElement, "nextOccurrence", logger); - int indexOf = stimuliElement.indexOf(nextOccurrence_time_deviationElement); + int indexOf = stimuliElement.indexOf(nextOccurrenceDeviationElement); - stimuliElement.removeContent(nextOccurrence_time_deviationElement); + stimuliElement.removeContent(nextOccurrenceDeviationElement); - if(migratedElement!=null) { - //adding migrated element to the stimuli element + if (migratedElement != null) { + // adding migrated element to the stimuli element stimuliElement.addContent(indexOf, migratedElement); } } + } else if (stimuliType.equals("am:VariableRateStimulus")) { + Element occurrencesPerStepDeviationElement = stimuliElement.getChild("occurrencesPerStep"); - }else if(stimuliType.equals("am:VariableRateStimulus")) { + if (occurrencesPerStepDeviationElement != null) { - Element occurrencesPerStep_double_deviationElement = stimuliElement.getChild("occurrencesPerStep"); + Element migratedElement = HelperUtils093.migrateDeviationElementContainingDoubleValue( + occurrencesPerStepDeviationElement, "occurrencesPerStep", logger); - if(occurrencesPerStep_double_deviationElement!=null) { + int indexOf = stimuliElement.indexOf(occurrencesPerStepDeviationElement); - Element migratedElement = HelperUtils_092_093.migrateDeviationElementContainingDoubleValue(occurrencesPerStep_double_deviationElement, "occurrencesPerStep", logger); + stimuliElement.removeContent(occurrencesPerStepDeviationElement); - int indexOf = stimuliElement.indexOf(occurrencesPerStep_double_deviationElement); - - stimuliElement.removeContent(occurrencesPerStep_double_deviationElement); - - if(migratedElement!=null) { - //adding migrated element to the stimuli element + if (migratedElement != null) { + // adding migrated element to the stimuli element stimuliElement.addContent(indexOf, migratedElement); } @@ -141,14 +139,17 @@ Element maxDecreasePerStepElement = stimuliElement.getChild("maxDecreasePerStep"); - //As DoubleObject is changed to Double (wrapper class) in model. Instead of child elements, xmi will have attributes for the below two parameters - if(maxIncreasePerStepElement!=null) { - stimuliElement.setAttribute("maxIncreasePerStep", maxIncreasePerStepElement.getAttributeValue("value")); + // As DoubleObject is changed to Double (wrapper class) in model. Instead of + // child elements, xmi will have attributes for the below two parameters + if (maxIncreasePerStepElement != null) { + stimuliElement.setAttribute("maxIncreasePerStep", + maxIncreasePerStepElement.getAttributeValue("value")); stimuliElement.removeContent(maxIncreasePerStepElement); } - if(maxDecreasePerStepElement!=null) { - stimuliElement.setAttribute("maxDecreasePerStep", maxDecreasePerStepElement.getAttributeValue("value")); + if (maxDecreasePerStepElement != null) { + stimuliElement.setAttribute("maxDecreasePerStep", + maxDecreasePerStepElement.getAttributeValue("value")); stimuliElement.removeContent(maxDecreasePerStepElement); } }
diff --git a/plugins/org.eclipse.app4mc.amalthea.converters.093/src/org/eclipse/app4mc/amalthea/converters093/impl/SwConverter.java b/plugins/org.eclipse.app4mc.amalthea.converters.093/src/org/eclipse/app4mc/amalthea/converters093/impl/SwConverter.java index b75e188..f1c0ea1 100644 --- a/plugins/org.eclipse.app4mc.amalthea.converters.093/src/org/eclipse/app4mc/amalthea/converters093/impl/SwConverter.java +++ b/plugins/org.eclipse.app4mc.amalthea.converters.093/src/org/eclipse/app4mc/amalthea/converters093/impl/SwConverter.java
@@ -32,7 +32,7 @@ import org.eclipse.app4mc.amalthea.converters.common.utils.HelperUtil; import org.eclipse.app4mc.amalthea.converters.common.utils.ModelVersion; import org.eclipse.app4mc.amalthea.converters093.utils.HWCacheBuilder; -import org.eclipse.app4mc.amalthea.converters093.utils.HelperUtils_092_093; +import org.eclipse.app4mc.amalthea.converters093.utils.HelperUtils093; import org.eclipse.app4mc.amalthea.converters093.utils.PUDefinitionIPCData; import org.eclipse.app4mc.util.sessionlog.SessionLogger; import org.jdom2.Attribute; @@ -43,12 +43,8 @@ import org.osgi.service.component.annotations.Component; import org.osgi.service.component.annotations.Reference; -@Component( - property = { - ServiceConstants.INPUT_MODEL_VERSION_PROPERTY + "=0.9.2", - ServiceConstants.OUTPUT_MODEL_VERSION_PROPERTY + "=0.9.3" - }, - service = IConverter.class) +@Component(property = { ServiceConstants.INPUT_MODEL_VERSION_PROPERTY + "=0.9.2", + ServiceConstants.OUTPUT_MODEL_VERSION_PROPERTY + "=0.9.3" }, service = IConverter.class) public class SwConverter extends AbstractConverter { private static final String AM = "am"; @@ -73,12 +69,13 @@ @Override public void convert(File targetFile, Map<File, Document> fileDocumentMapping, List<ICache> caches) { - logger.info( - "Migration from 0.9.2 to 0.9.3 : Executing Sw converter for model file : {0}", targetFile.getName()); + logger.info("Migration from 0.9.2 to 0.9.3 : Executing Sw converter for model file : {0}", + targetFile.getName()); this.cache = getHWCache(caches); if (this.cache == null) { - throw new IllegalStateException("PUDefinition_IPCData is not built and Object of it is not available in Converters"); + throw new IllegalStateException( + "PUDefinition_IPCData is not built and Object of it is not available in Converters"); } final Document root = fileDocumentMapping.get(targetFile); @@ -88,60 +85,62 @@ } final Element rootElement = root.getRootElement(); - update_ExecutionNeed(rootElement); + updateExecutionNeed(rootElement); - update_ChunkProcessingInstructions(rootElement); + updateChunkProcessingInstructions(rootElement); - update_activations(rootElement); + updateActivations(rootElement); } - private void update_activations(Element rootElement) { + private void updateActivations(Element rootElement) { final StringBuilder xpathBuffer = new StringBuilder(); xpathBuffer.append("./swModel/activations"); - final List<Element> activationElements = HelperUtil.getXpathResult( - rootElement, - xpathBuffer.toString(), - Element.class, - AmaltheaNamespaceRegistry.getNamespace(ModelVersion.VERSION_093, AM), + final List<Element> activationElements = HelperUtil.getXpathResult(rootElement, xpathBuffer.toString(), + Element.class, AmaltheaNamespaceRegistry.getNamespace(ModelVersion.VERSION_093, AM), AmaltheaNamespaceRegistry.getGenericNamespace(XSI)); for (Element activationElement : activationElements) { - String activationType=activationElement.getAttributeValue(TYPE, AmaltheaNamespaceRegistry.getGenericNamespace(XSI)); + String activationType = activationElement.getAttributeValue(TYPE, + AmaltheaNamespaceRegistry.getGenericNamespace(XSI)); - if(activationType!=null) { + if (activationType != null) { - if(activationType.equals("am:VariableRateActivation")) { + if (activationType.equals("am:VariableRateActivation")) { - Element occurrencesPerStep_double_deviationElement = activationElement.getChild("occurrencesPerStep"); + Element occurrencesPerStepDeviationElement = activationElement + .getChild("occurrencesPerStep"); - if(occurrencesPerStep_double_deviationElement!=null) { + if (occurrencesPerStepDeviationElement != null) { - Element migratedElement = HelperUtils_092_093.migrateDeviationElementContainingDoubleValue(occurrencesPerStep_double_deviationElement, "occurrencesPerStep", logger); + Element migratedElement = HelperUtils093.migrateDeviationElementContainingDoubleValue( + occurrencesPerStepDeviationElement, "occurrencesPerStep", logger); - int indexOf = activationElement.indexOf(occurrencesPerStep_double_deviationElement); + int indexOf = activationElement.indexOf(occurrencesPerStepDeviationElement); - activationElement.removeContent(occurrencesPerStep_double_deviationElement); + activationElement.removeContent(occurrencesPerStepDeviationElement); - if(migratedElement!=null) { - //adding migrated element to the activation element + if (migratedElement != null) { + // adding migrated element to the activation element activationElement.addContent(indexOf, migratedElement); } } - } else if(activationType.equals("am:SporadicActivation")) { + } else if (activationType.equals("am:SporadicActivation")) { - Element activationDeviation_Time_deviationElement = activationElement.getChild("activationDeviation"); + Element activationDeviationElement = activationElement + .getChild("activationDeviation"); - if(activationDeviation_Time_deviationElement!=null) { + if (activationDeviationElement != null) { - Element migratedElement = HelperUtils_092_093.migrateDeviationElementContainingTimeValue(activationDeviation_Time_deviationElement, "activationDeviation", logger); + Element migratedElement = HelperUtils093.migrateDeviationElementContainingTimeValue( + activationDeviationElement, "activationDeviation", logger); - int indexOf = activationElement.indexOf(activationDeviation_Time_deviationElement); + int indexOf = activationElement.indexOf(activationDeviationElement); - activationElement.removeContent(activationDeviation_Time_deviationElement); + activationElement.removeContent(activationDeviationElement); - if (migratedElement!=null) { - //adding migrated element to the activation element + if (migratedElement != null) { + // adding migrated element to the activation element activationElement.addContent(indexOf, migratedElement); migratedElement.setName("occurrence"); @@ -152,7 +151,7 @@ } } - private void update_ChunkProcessingInstructions(Element rootElement) { + private void updateChunkProcessingInstructions(Element rootElement) { final StringBuilder xpathBuffer = new StringBuilder(); @@ -161,49 +160,48 @@ * */ - xpathBuffer.append("./swModel/runnables//*[@xsi:type=\"am:LabelAccess\" or @xsi:type=\"am:ChannelSend\" or @xsi:type=\"am:ChannelReceive\"]/transmissionPolicy"); + xpathBuffer.append( + "./swModel/runnables//*[@xsi:type=\"am:LabelAccess\" or @xsi:type=\"am:ChannelSend\" or @xsi:type=\"am:ChannelReceive\"]/transmissionPolicy"); xpathBuffer.append("|"); - xpathBuffer.append("./osModel/operatingSystems/taskSchedulers/computationItems[@xsi:type=\"am:LabelAccess\"]/transmissionPolicy"); + xpathBuffer.append( + "./osModel/operatingSystems/taskSchedulers/computationItems[@xsi:type=\"am:LabelAccess\"]/transmissionPolicy"); xpathBuffer.append("|"); - xpathBuffer.append("./osModel/operatingSystems/interruptControllers/computationItems[@xsi:type=\"am:LabelAccess\"]/transmissionPolicy"); + xpathBuffer.append( + "./osModel/operatingSystems/interruptControllers/computationItems[@xsi:type=\"am:LabelAccess\"]/transmissionPolicy"); - final List<Element> transmissionPolicyElements = HelperUtil.getXpathResult( - rootElement, - xpathBuffer.toString(), - Element.class, - AmaltheaNamespaceRegistry.getNamespace(ModelVersion.VERSION_093, AM), + final List<Element> transmissionPolicyElements = HelperUtil.getXpathResult(rootElement, xpathBuffer.toString(), + Element.class, AmaltheaNamespaceRegistry.getNamespace(ModelVersion.VERSION_093, AM), AmaltheaNamespaceRegistry.getGenericNamespace(XSI)); for (Element transmissionPolicyElement : transmissionPolicyElements) { Attribute attribute = transmissionPolicyElement.getAttribute("chunkProcessingInstructions"); - if(attribute!=null) { + if (attribute != null) { attribute.setName("chunkProcessingTicks"); } } } - private void update_ExecutionNeed(final Element rootElement) { + private void updateExecutionNeed(final Element rootElement) { final StringBuilder xpathBuffer = new StringBuilder(); /* - * As per the change in 0.9.3, ExecutionNeed (of 0.9.2) with default and extended entries - * having key as Instructions, is converted to ExecutionTicks + * As per the change in 0.9.3, ExecutionNeed (of 0.9.2) with default and + * extended entries having key as Instructions, is converted to ExecutionTicks */ xpathBuffer.append("./swModel/runnables//*[@xsi:type=\"am:ExecutionNeed\"]"); xpathBuffer.append("|"); - xpathBuffer.append("./osModel/operatingSystems/taskSchedulers/computationItems[@xsi:type=\"am:ExecutionNeed\"]"); + xpathBuffer + .append("./osModel/operatingSystems/taskSchedulers/computationItems[@xsi:type=\"am:ExecutionNeed\"]"); xpathBuffer.append("|"); - xpathBuffer.append("./osModel/operatingSystems/interruptControllers/computationItems[@xsi:type=\"am:ExecutionNeed\"]"); + xpathBuffer.append( + "./osModel/operatingSystems/interruptControllers/computationItems[@xsi:type=\"am:ExecutionNeed\"]"); - final List<Element> executionNeeds = HelperUtil.getXpathResult( - rootElement, - xpathBuffer.toString(), - Element.class, - AmaltheaNamespaceRegistry.getNamespace(ModelVersion.VERSION_093, AM), + final List<Element> executionNeeds = HelperUtil.getXpathResult(rootElement, xpathBuffer.toString(), + Element.class, AmaltheaNamespaceRegistry.getNamespace(ModelVersion.VERSION_093, AM), AmaltheaNamespaceRegistry.getGenericNamespace(XSI)); for (final Element executionNeedElement : executionNeeds) { @@ -263,13 +261,11 @@ Element newExecutionNeedsElement = null; - - Set<Entry<String, Element>> entrySet = defaultElementsMap.entrySet(); Iterator<Entry<String, Element>> iterator = entrySet.iterator(); - while(iterator.hasNext()) { + while (iterator.hasNext()) { Entry<String, Element> next = iterator.next(); @@ -282,11 +278,11 @@ /*- ------ExecutionTicks element --------------*/ newExecutionTicksElement = new Element(nodeName); - Attribute typeAttribute = new Attribute(TYPE, "am:Ticks", AmaltheaNamespaceRegistry.getGenericNamespace(XSI)); + Attribute typeAttribute = new Attribute(TYPE, "am:Ticks", + AmaltheaNamespaceRegistry.getGenericNamespace(XSI)); newExecutionTicksElement.getAttributes().add(typeAttribute); - /*- * <default key="Instructions"> <value xsi:type="am:NeedConstant" value="20"/> @@ -294,20 +290,18 @@ */ Element valueElement = defaultInstructionsElement.getChild(VALUE); - Element default_executionTicksElement = createTicksElementFromNeed(valueElement, "default", 1.0); + Element defaultExecutionTicksElement = createTicksElementFromNeed(valueElement, "default", 1.0); - if (default_executionTicksElement != null) { + if (defaultExecutionTicksElement != null) { // Adding default ExecutionTicks element - newExecutionTicksElement.addContent(default_executionTicksElement); + newExecutionTicksElement.addContent(defaultExecutionTicksElement); } } else { if (containerType.equals(TASK_SCHEDULER) || containerType.equals(INTERRUPT_CONTROLLER)) { - logger.warn("In {0} : {1}, ExecutionNeed element's NeedEntry (having HwFeatureCategory : {2})-> can not be migrated. As this is not supported in 0.9.3. \nIn {3} element only NeedEntry elements having HwFeatureCategory Instructions are migrated to Ticks", - containerType, - containerElementName, - key, - containerType); + logger.warn( + "In {0} : {1}, ExecutionNeed element's NeedEntry (having HwFeatureCategory : {2})-> can not be migrated. As this is not supported in 0.9.3. \nIn {3} element only NeedEntry elements having HwFeatureCategory Instructions are migrated to Ticks", + containerType, containerElementName, key, containerType); continue; } Element defaultExecutionNeedElement = defaultElementsMap.get(key); @@ -331,7 +325,7 @@ Element valueElement = defaultExecutionNeedElement.getChild(VALUE); if (valueElement != null) { - Element newNeedElementValue = createTicksElementFromNeed(valueElement, VALUE,1.0); + Element newNeedElementValue = createTicksElementFromNeed(valueElement, VALUE, 1.0); if (newNeedElementValue != null) { Element needsElement = new Element("needs"); @@ -354,20 +348,17 @@ for (Element extendedElement : extendedElements) { - Double ipcValue=getIPCValue(extendedElement); + Double ipcValue = getIPCValue(extendedElement); - final List<Element> valueElements = HelperUtil.getXpathResult( - extendedElement, - "./value[@key=\"Instructions\"]", - Element.class, + final List<Element> valueElements = HelperUtil.getXpathResult(extendedElement, + "./value[@key=\"Instructions\"]", Element.class, AmaltheaNamespaceRegistry.getNamespace(ModelVersion.VERSION_093, AM)); if (!valueElements.isEmpty()) { - Element extended_executionTicksElement = new Element("extended"); + Element extendedExecutionTicksElement = new Element("extended"); - HelperUtil.copyElement_Attribute_or_Element(extendedElement, extended_executionTicksElement, - KEY); + HelperUtil.copyElementAttributeOrElement(extendedElement, extendedExecutionTicksElement, KEY); /*- * <extended key="puDef?type=ProcessingUnitDefinition"> <value key="Instructions"> @@ -380,11 +371,11 @@ Element valueValueElement = valueElement.getChild(VALUE); - Element value_executionTicksElement = createTicksElementFromNeed(valueValueElement, VALUE,ipcValue); + Element valueExecutionTicksElement = createTicksElementFromNeed(valueValueElement, VALUE, ipcValue); - if (value_executionTicksElement != null) { + if (valueExecutionTicksElement != null) { /*- adding value to the Extended ticks element */ - extended_executionTicksElement.addContent(value_executionTicksElement); + extendedExecutionTicksElement.addContent(valueExecutionTicksElement); // Adding extended ExecutionTicks element @@ -396,14 +387,14 @@ newExecutionTicksElement.getAttributes().add(typeAttribute); } - newExecutionTicksElement.addContent(extended_executionTicksElement); + newExecutionTicksElement.addContent(extendedExecutionTicksElement); } } } - List<Element> newRunnableItemElementsList=new ArrayList<>(); + List<Element> newRunnableItemElementsList = new ArrayList<>(); if (newExecutionTicksElement != null) { @@ -421,16 +412,12 @@ parent.addContent(indexOf, newRunnableItemElementsList); } - final List<Element> skippedValuesExtended = HelperUtil.getXpathResult( - executionNeedElement, - "./extended/value[not(@key=\"Instructions\")]", - Element.class, + final List<Element> skippedValuesExtended = HelperUtil.getXpathResult(executionNeedElement, + "./extended/value[not(@key=\"Instructions\")]", Element.class, AmaltheaNamespaceRegistry.getNamespace(ModelVersion.VERSION_093, AM)); - final List<Element> skippedValuesDefault = HelperUtil.getXpathResult( - executionNeedElement, - "./default[not(@key=\"Instructions\")]", - Element.class, + final List<Element> skippedValuesDefault = HelperUtil.getXpathResult(executionNeedElement, + "./default[not(@key=\"Instructions\")]", Element.class, AmaltheaNamespaceRegistry.getNamespace(ModelVersion.VERSION_093, AM)); StringBuilder extendedElementsbuffer = new StringBuilder(); @@ -447,17 +434,18 @@ } if (extendedElementsbuffer.length() > 0) { - logger.info("In {0} : \"{1}, \" Entries of ExecutionNeed (extended elements) with following keys can not be migrated : {2} -> (only supported \"HwFeatureCategory\" as key is : \"Instructions\")", - containerType, - containerElementName, + logger.info( + "In {0} : \"{1}, \" Entries of ExecutionNeed (extended elements) with following keys can not be migrated : {2} -> (only supported \"HwFeatureCategory\" as key is : \"Instructions\")", + containerType, containerElementName, extendedElementsbuffer.toString().substring(0, extendedElementsbuffer.length() - 1)); } - if ((defaultElementsbuffer.length() > 0)&&(containerType.equals(TASK_SCHEDULER)||containerType.equals(INTERRUPT_CONTROLLER))) { - logger.info("In {0} : \"{1}, \" Entries of ExecutionNeed (default elements) with following keys can not be migrated : {2} ->(only supported \"HwFeatureCategory\" as key is : \"Instructions\")", - containerType, - containerElementName, + if ((defaultElementsbuffer.length() > 0) + && (containerType.equals(TASK_SCHEDULER) || containerType.equals(INTERRUPT_CONTROLLER))) { + logger.info( + "In {0} : \"{1}, \" Entries of ExecutionNeed (default elements) with following keys can not be migrated : {2} ->(only supported \"HwFeatureCategory\" as key is : \"Instructions\")", + containerType, containerElementName, defaultElementsbuffer.toString().substring(0, defaultElementsbuffer.length() - 1)); } @@ -487,37 +475,36 @@ return 1d; } + private Element createTicksElementFromNeed(Element valueElement, String newElementName, double ipcValue) { + if (valueElement != null) { + String valueType = valueElement.getAttributeValue(TYPE, AmaltheaNamespaceRegistry.getGenericNamespace(XSI)); + /*- it can be either NeedConstant or NeedDeviation */ + if (valueType != null && valueType.equals("am:NeedConstant")) { - private Element createTicksElementFromNeed( Element valueElement, String newElementName, double ipcValue) { - if(valueElement !=null) { - String valueType = valueElement.getAttributeValue(TYPE, AmaltheaNamespaceRegistry.getGenericNamespace(XSI)); - /*- it can be either NeedConstant or NeedDeviation */ + Element executionTicksElement = new Element(newElementName); - if(valueType !=null && valueType.equals("am:NeedConstant")) { + Attribute defaultExecutionTicksTypeAttribute = new Attribute(TYPE, "am:DiscreteValueConstant", + AmaltheaNamespaceRegistry.getGenericNamespace(XSI)); - Element tc_executionTicksElement=new Element(newElementName); + executionTicksElement.getAttributes().add(defaultExecutionTicksTypeAttribute); - Attribute default_executionTicksElement_TypeAttribute=new Attribute(TYPE, "am:DiscreteValueConstant", - AmaltheaNamespaceRegistry.getGenericNamespace(XSI)); + String valueValue = valueElement.getAttributeValue(VALUE); - tc_executionTicksElement.getAttributes().add(default_executionTicksElement_TypeAttribute); + if (valueValue != null) { + // TODO: divide with value of Instructions + executionTicksElement.getAttributes().add(new Attribute(VALUE, + HelperUtils093.getValueAfterApplyingIPC(valueValue, ipcValue, logger))); + } + return executionTicksElement; + } else if (valueType != null && valueType.equals("am:NeedDeviation")) { - String valueValue = valueElement.getAttributeValue(VALUE); + Element deviationElement = valueElement.getChild("deviation"); - if(valueValue!=null) { - //TODO: divide with value of Instructions - tc_executionTicksElement.getAttributes().add(new Attribute(VALUE, HelperUtils_092_093.getValueAfterApplyingIPC(valueValue, ipcValue, logger))); - } - - return tc_executionTicksElement; - } else if(valueType !=null && valueType.equals("am:NeedDeviation")) { - - Element deviationElement = valueElement.getChild("deviation"); - - return HelperUtils_092_093.migrateDeviationElementContainingLongValue(deviationElement, newElementName, ipcValue, logger); - } + return HelperUtils093.migrateDeviationElementContainingLongValue(deviationElement, newElementName, + ipcValue, logger); + } } return null; }
diff --git a/plugins/org.eclipse.app4mc.amalthea.converters.093/src/org/eclipse/app4mc/amalthea/converters093/utils/HelperUtils_092_093.java b/plugins/org.eclipse.app4mc.amalthea.converters.093/src/org/eclipse/app4mc/amalthea/converters093/utils/HelperUtils093.java similarity index 99% rename from plugins/org.eclipse.app4mc.amalthea.converters.093/src/org/eclipse/app4mc/amalthea/converters093/utils/HelperUtils_092_093.java rename to plugins/org.eclipse.app4mc.amalthea.converters.093/src/org/eclipse/app4mc/amalthea/converters093/utils/HelperUtils093.java index 377b316..91c1c1f 100644 --- a/plugins/org.eclipse.app4mc.amalthea.converters.093/src/org/eclipse/app4mc/amalthea/converters093/utils/HelperUtils_092_093.java +++ b/plugins/org.eclipse.app4mc.amalthea.converters.093/src/org/eclipse/app4mc/amalthea/converters093/utils/HelperUtils093.java
@@ -21,7 +21,7 @@ import org.jdom2.Attribute; import org.jdom2.Element; -public final class HelperUtils_092_093 { +public final class HelperUtils093 { private static final String XSI = "xsi"; private static final String TYPE = "type"; @@ -47,7 +47,7 @@ "Deviation with \"WeibullParameters\" as distribution can not be migrated" + "as the semantics of \"WeibullParameters\" were not clearly described"; - private HelperUtils_092_093() { + private HelperUtils093() { // empty private default constructor }
diff --git a/plugins/org.eclipse.app4mc.amalthea.converters.common/src/org/eclipse/app4mc/amalthea/converters/common/converter/NamespaceConverter.java b/plugins/org.eclipse.app4mc.amalthea.converters.common/src/org/eclipse/app4mc/amalthea/converters/common/converter/NamespaceConverter.java index 2c2f20a..36947cc 100644 --- a/plugins/org.eclipse.app4mc.amalthea.converters.common/src/org/eclipse/app4mc/amalthea/converters/common/converter/NamespaceConverter.java +++ b/plugins/org.eclipse.app4mc.amalthea.converters.common/src/org/eclipse/app4mc/amalthea/converters/common/converter/NamespaceConverter.java
@@ -74,7 +74,7 @@ ModelVersion outputVersion = ModelVersion.getModelVersion(getOutputModelVersion()); if (inputVersion != null && outputVersion != null) { - HelperUtil.updateRootElement_NameSpaces( + HelperUtil.updateRootElementNamespaces( rootElement, inputVersion, outputVersion);
diff --git a/plugins/org.eclipse.app4mc.amalthea.converters.common/src/org/eclipse/app4mc/amalthea/converters/common/utils/HelperUtil.java b/plugins/org.eclipse.app4mc.amalthea.converters.common/src/org/eclipse/app4mc/amalthea/converters/common/utils/HelperUtil.java index e6a893f..615570a 100644 --- a/plugins/org.eclipse.app4mc.amalthea.converters.common/src/org/eclipse/app4mc/amalthea/converters/common/utils/HelperUtil.java +++ b/plugins/org.eclipse.app4mc.amalthea.converters.common/src/org/eclipse/app4mc/amalthea/converters/common/utils/HelperUtil.java
@@ -104,7 +104,7 @@ * * @param rootElement */ - public static void updateRootElement_NameSpaces(Element rootElement, ModelVersion oldNsVersion, ModelVersion newNsVersion) { + public static void updateRootElementNamespaces(Element rootElement, ModelVersion oldNsVersion, ModelVersion newNsVersion) { final Namespace defaultNamespace = rootElement.getNamespace(); @@ -414,7 +414,7 @@ * @param childNodeOrAttributeName * name of the child element. Method should detect if the child with this name exists as a */ - public static void copyElement_Attribute_or_Element(final Element sourceElement, final Element targetElement, final String childNodeOrAttributeName) { + public static void copyElementAttributeOrElement(final Element sourceElement, final Element targetElement, final String childNodeOrAttributeName) { final Attribute attribute = sourceElement.getAttribute(childNodeOrAttributeName);
diff --git a/plugins/org.eclipse.app4mc.amalthea.converters.common/src/org/eclipse/app4mc/amalthea/converters/common/utils/ModelVersion.java b/plugins/org.eclipse.app4mc.amalthea.converters.common/src/org/eclipse/app4mc/amalthea/converters/common/utils/ModelVersion.java index afc1f6a..ce004c3 100644 --- a/plugins/org.eclipse.app4mc.amalthea.converters.common/src/org/eclipse/app4mc/amalthea/converters/common/utils/ModelVersion.java +++ b/plugins/org.eclipse.app4mc.amalthea.converters.common/src/org/eclipse/app4mc/amalthea/converters/common/utils/ModelVersion.java
@@ -95,6 +95,7 @@ versions.add(allVersions[i]); } return versions.toArray(new ModelVersion[0]); + } /**
diff --git a/plugins/org.eclipse.app4mc.util.sessionlog.console/src/org/eclipse/app4mc/util/sessionlog/console/SessionLogConsoleWriter.java b/plugins/org.eclipse.app4mc.util.sessionlog.console/src/org/eclipse/app4mc/util/sessionlog/console/SessionLogConsoleWriter.java index 64c35bd..721a52a 100644 --- a/plugins/org.eclipse.app4mc.util.sessionlog.console/src/org/eclipse/app4mc/util/sessionlog/console/SessionLogConsoleWriter.java +++ b/plugins/org.eclipse.app4mc.util.sessionlog.console/src/org/eclipse/app4mc/util/sessionlog/console/SessionLogConsoleWriter.java
@@ -28,6 +28,9 @@ @Component public class SessionLogConsoleWriter implements SessionLogWriter { + // S106 - Standard outputs should not be used directly to log anything + // Purpose of this method is to write log entries to console + @SuppressWarnings( {"squid:S106"}) @Override public void write(File sessionLogFile, List<SessionLogEntry> log) { String logLevel = System.getProperty("app4mc.log.level");
diff --git a/tests/org.eclipse.app4mc.amalthea.converters.071.tests/src/org/eclipse/app4mc/amalthea/converters071/tests/ConstraintsConverterTest.java b/tests/org.eclipse.app4mc.amalthea.converters.071.tests/src/org/eclipse/app4mc/amalthea/converters071/tests/ConstraintsConverterTest.java index 1cedd1a..9d16621 100644 --- a/tests/org.eclipse.app4mc.amalthea.converters.071.tests/src/org/eclipse/app4mc/amalthea/converters071/tests/ConstraintsConverterTest.java +++ b/tests/org.eclipse.app4mc.amalthea.converters.071.tests/src/org/eclipse/app4mc/amalthea/converters071/tests/ConstraintsConverterTest.java
@@ -49,17 +49,17 @@ @Parameterized.Parameters(name = "{index}: Test data ID: {0}. Description : {3}") public static Collection<Object[]> getTestData() { - final String[] inputFiles_500501 = new String[] { "/constraints/500501/constraints_500501.amxmi", + final String[] inputFiles500501 = new String[] { "/constraints/500501/constraints_500501.amxmi", "/constraints/500501/constraints_2_500501.amxmi" }; - final String[] inputFiles_500502 = new String[] { "/constraints/500502/constraints_500502.amxmi", + final String[] inputFiles500502 = new String[] { "/constraints/500502/constraints_500502.amxmi", "/constraints/500502/constraints_sw_model.amxmi" }; - final String[] inputFiles_500506 = new String[] { "/constraints/500506/constraints_500506.amxmi" }; + final String[] inputFiles500506 = new String[] { "/constraints/500506/constraints_500506.amxmi" }; - return Arrays.asList(new Object[][] { { "500501", true, inputFiles_500501, "AffinityConstraint change" }, - { "500502", true, inputFiles_500502, "RunnableSequencingConstraint change" }, - { "500506", true, inputFiles_500506, "Timing Constraints change" } }); + return Arrays.asList(new Object[][] { { "500501", true, inputFiles500501, "AffinityConstraint change" }, + { "500502", true, inputFiles500502, "RunnableSequencingConstraint change" }, + { "500506", true, inputFiles500506, "Timing Constraints change" } }); } public ConstraintsConverterTest(final String testDataID, final boolean canExecuteTestCase, final String[] xmlFiles, @@ -87,17 +87,17 @@ final Element rootElement = this.fileDocumentMapping.get(file).getRootElement(); /*- - * ===Verifying existance of SchedulerSeparationConstraint and SchedulerPairingConstraint content=== + * ===Verifying existence of SchedulerSeparationConstraint and SchedulerPairingConstraint content=== */ verifyAffinityConstraints(file, rootElement); /*- - * ===Verifying existance of OrderConstraint content=== + * ===Verifying existence of OrderConstraint content=== */ verifyOrderConstraints(file, rootElement); /*- - * ===Verifying existance of EventChainLatencyConstraint content (Age/Reaction), DelayConstraints -> mappingType, SynchronisationConstraint + * ===Verifying existence of EventChainLatencyConstraint content (Age/Reaction), DelayConstraints -> mappingType, SynchronisationConstraint === */ verifyTimingConstraints(file, rootElement); @@ -115,7 +115,7 @@ private void verifyTimingConstraints(final File file, final Element rootElement) { - final List<Element> age_reaction_Constraints = HelperUtil.getXpathResult( + final List<Element> ageReactionConstraints = HelperUtil.getXpathResult( rootElement, "./constraintsModel/timingConstraints[@xsi:type=\"am:AgeConstraint\" or @xsi:type=\"am:ReactionConstraint\"]", Element.class, @@ -123,7 +123,7 @@ AmaltheaNamespaceRegistry.getNamespace(ModelVersion.VERSION_071, AM)); assertEquals("Age/Reaction Constraints are not migrated to 0.7.1 format in model file : " + file.getName(), - 0, age_reaction_Constraints.size()); + 0, ageReactionConstraints.size()); final List<Element> delayConstraints = HelperUtil.getXpathResult( @@ -197,7 +197,7 @@ private void verifyAffinityConstraints(final File file, final Element rootElement) { - final List<Element> sch_pairing_separation_constraints = HelperUtil.getXpathResult( + final List<Element> separationConstraints = HelperUtil.getXpathResult( rootElement, "./constraintsModel/affinityConstraints[@xsi:type=\"am:SchedulerPairingConstraint\" or @xsi:type=\"am:SchedulerSeparationConstraint\" ]", Element.class, @@ -206,6 +206,6 @@ assertEquals( "SchedulerPairing and SchedulerSeparation constraints are not migrated to 0.7.1 format in model file : " + file.getName(), - 0, sch_pairing_separation_constraints.size()); + 0, separationConstraints.size()); } }
diff --git a/tests/org.eclipse.app4mc.amalthea.converters.071.tests/src/org/eclipse/app4mc/amalthea/converters071/tests/SwConverterTest.java b/tests/org.eclipse.app4mc.amalthea.converters.071.tests/src/org/eclipse/app4mc/amalthea/converters071/tests/SwConverterTest.java index c1dffb9..2f0effb 100644 --- a/tests/org.eclipse.app4mc.amalthea.converters.071.tests/src/org/eclipse/app4mc/amalthea/converters071/tests/SwConverterTest.java +++ b/tests/org.eclipse.app4mc.amalthea.converters.071.tests/src/org/eclipse/app4mc/amalthea/converters071/tests/SwConverterTest.java
@@ -45,13 +45,13 @@ public static Collection<Object[]> getTestData() { - final String[] inputFiles_Section = new String[] { "/sw/AMALTHEA_Democar.amxmi" }; + final String[] inputFilesSection = new String[] { "/sw/AMALTHEA_Democar.amxmi" }; - final String[] inputFiles_ModeSwitch = new String[] { "/sw/modeswitch/modeswitch.amxmi", + final String[] inputFilesModeSwitch = new String[] { "/sw/modeswitch/modeswitch.amxmi", "/sw/modeswitch/modeliterals.amxmi", "/sw/modeswitch/modeswtich_isrs.amxmi" }; - return Arrays.asList(new Object[][] { { "Sections : 1", true, inputFiles_Section }, - { "ModeSwitchEntry_Scenario : 2", true, inputFiles_ModeSwitch } }); + return Arrays.asList(new Object[][] { { "Sections : 1", true, inputFilesSection }, + { "ModeSwitchEntry_Scenario : 2", true, inputFilesModeSwitch } }); } public SwConverterTest(final String testDataID, final boolean canExecuteTestCase, final String[] xmlFiles) {
diff --git a/tests/org.eclipse.app4mc.amalthea.converters.071.tests/src/org/eclipse/app4mc/amalthea/converters071/tests/Sw_SectionConverterTest.java b/tests/org.eclipse.app4mc.amalthea.converters.071.tests/src/org/eclipse/app4mc/amalthea/converters071/tests/SwSectionConverterTest.java similarity index 97% rename from tests/org.eclipse.app4mc.amalthea.converters.071.tests/src/org/eclipse/app4mc/amalthea/converters071/tests/Sw_SectionConverterTest.java rename to tests/org.eclipse.app4mc.amalthea.converters.071.tests/src/org/eclipse/app4mc/amalthea/converters071/tests/SwSectionConverterTest.java index 8c5728f..a74db35 100644 --- a/tests/org.eclipse.app4mc.amalthea.converters.071.tests/src/org/eclipse/app4mc/amalthea/converters071/tests/Sw_SectionConverterTest.java +++ b/tests/org.eclipse.app4mc.amalthea.converters.071.tests/src/org/eclipse/app4mc/amalthea/converters071/tests/SwSectionConverterTest.java
@@ -41,7 +41,7 @@ @FixMethodOrder(MethodSorters.NAME_ASCENDING) @RunWith(Parameterized.class) -public class Sw_SectionConverterTest extends Abstract071ConverterTest { +public class SwSectionConverterTest extends Abstract071ConverterTest { @Parameterized.Parameters(name = "{index}: Test data ID: {0}") public static Collection<Object[]> getTestData() { @@ -53,7 +53,7 @@ return Arrays.asList(new Object[][] { { "Sections-Constraints-Conversion : 1", true, inputFiles } }); } - public Sw_SectionConverterTest(final String testDataID, final boolean canExecuteTestCase, final String[] xmlFiles) { + public SwSectionConverterTest(final String testDataID, final boolean canExecuteTestCase, final String[] xmlFiles) { super(canExecuteTestCase, xmlFiles); }
diff --git a/tests/org.eclipse.app4mc.amalthea.converters.080.tests/src/org/eclipse/app4mc/amalthea/converters080/tests/DataSizeConverterTest.java b/tests/org.eclipse.app4mc.amalthea.converters.080.tests/src/org/eclipse/app4mc/amalthea/converters080/tests/DataSizeConverterTest.java index f0966a6..436c834 100644 --- a/tests/org.eclipse.app4mc.amalthea.converters.080.tests/src/org/eclipse/app4mc/amalthea/converters080/tests/DataSizeConverterTest.java +++ b/tests/org.eclipse.app4mc.amalthea.converters.080.tests/src/org/eclipse/app4mc/amalthea/converters080/tests/DataSizeConverterTest.java
@@ -36,9 +36,9 @@ @Parameterized.Parameters(name = "{index}: Test data ID: {0}. Description : {3}") public static Collection<Object[]> getTestData() { - String[] inputFiles_swModeLabels = new String[] { "/datasize/dataSizeChanges.amxmi" }; + String[] inputFilesModeLabels = new String[] { "/datasize/dataSizeChanges.amxmi" }; - return Arrays.asList(new Object[][] { { "Models with DataSize", true, inputFiles_swModeLabels, + return Arrays.asList(new Object[][] { { "Models with DataSize", true, inputFilesModeLabels, "Migration of Amalthea models containing DataSize " } }); }
diff --git a/tests/org.eclipse.app4mc.amalthea.converters.080.tests/src/org/eclipse/app4mc/amalthea/converters080/tests/MappingConverterTest.java b/tests/org.eclipse.app4mc.amalthea.converters.080.tests/src/org/eclipse/app4mc/amalthea/converters080/tests/MappingConverterTest.java index c863139..7e9b117 100644 --- a/tests/org.eclipse.app4mc.amalthea.converters.080.tests/src/org/eclipse/app4mc/amalthea/converters080/tests/MappingConverterTest.java +++ b/tests/org.eclipse.app4mc.amalthea.converters.080.tests/src/org/eclipse/app4mc/amalthea/converters080/tests/MappingConverterTest.java
@@ -34,9 +34,9 @@ @Parameterized.Parameters(name = "{index}: Test data ID: {0}. Description : {3}") public static Collection<Object[]> getTestData() { - String[] inputFiles_swModeLabels = new String[] { "/mapping/mapping.amxmi" }; + String[] inputFilesModeLabels = new String[] { "/mapping/mapping.amxmi" }; - return Arrays.asList(new Object[][] { { "ModeLabel", true, inputFiles_swModeLabels, + return Arrays.asList(new Object[][] { { "ModeLabel", true, inputFilesModeLabels, "Migration of Amalthea models containing AbstractElementMapping" } }); }
diff --git a/tests/org.eclipse.app4mc.amalthea.converters.080.tests/src/org/eclipse/app4mc/amalthea/converters080/tests/ProbabilitySwitchConverterTest.java b/tests/org.eclipse.app4mc.amalthea.converters.080.tests/src/org/eclipse/app4mc/amalthea/converters080/tests/ProbabilitySwitchConverterTest.java index ad7f3c5..8585a6e 100644 --- a/tests/org.eclipse.app4mc.amalthea.converters.080.tests/src/org/eclipse/app4mc/amalthea/converters080/tests/ProbabilitySwitchConverterTest.java +++ b/tests/org.eclipse.app4mc.amalthea.converters.080.tests/src/org/eclipse/app4mc/amalthea/converters080/tests/ProbabilitySwitchConverterTest.java
@@ -37,9 +37,9 @@ @Parameterized.Parameters(name = "{index}: Test data ID: {0}. Description : {3}") public static Collection<Object[]> getTestData() { - final String[] inputFiles_swModeLabels = new String[] { "/probabilitySwitch/probabilitySwitch.amxmi" }; + final String[] inputFilesModeLabels = new String[] { "/probabilitySwitch/probabilitySwitch.amxmi" }; - return Arrays.asList(new Object[][] { { "Models with ProbabilitySwitch", true, inputFiles_swModeLabels, + return Arrays.asList(new Object[][] { { "Models with ProbabilitySwitch", true, inputFilesModeLabels, "Migration of Amalthea models containing probabil(t)itySwitch " } }); }
diff --git a/tests/org.eclipse.app4mc.amalthea.converters.080.tests/src/org/eclipse/app4mc/amalthea/converters080/tests/SignedTimeConverterTest.java b/tests/org.eclipse.app4mc.amalthea.converters.080.tests/src/org/eclipse/app4mc/amalthea/converters080/tests/SignedTimeConverterTest.java index 3464b12..a801cf9 100644 --- a/tests/org.eclipse.app4mc.amalthea.converters.080.tests/src/org/eclipse/app4mc/amalthea/converters080/tests/SignedTimeConverterTest.java +++ b/tests/org.eclipse.app4mc.amalthea.converters.080.tests/src/org/eclipse/app4mc/amalthea/converters080/tests/SignedTimeConverterTest.java
@@ -37,9 +37,9 @@ @Parameterized.Parameters(name = "{index}: Test data ID: {0}. Description : {3}") public static Collection<Object[]> getTestData() { - String[] inputFiles_swModeLabels = new String[] { "/signedTime/signedTime.amxmi" }; + String[] inputFilesModeLabels = new String[] { "/signedTime/signedTime.amxmi" }; - return Arrays.asList(new Object[][] { { "ModeLabel", true, inputFiles_swModeLabels, + return Arrays.asList(new Object[][] { { "ModeLabel", true, inputFilesModeLabels, "Migration of Amalthea models containing ModeLabels (both simple and cross references)" } }); }
diff --git a/tests/org.eclipse.app4mc.amalthea.converters.080.tests/src/org/eclipse/app4mc/amalthea/converters080/tests/SwConverterTest.java b/tests/org.eclipse.app4mc.amalthea.converters.080.tests/src/org/eclipse/app4mc/amalthea/converters080/tests/SwConverterTest.java index 6375888..704a5fb 100644 --- a/tests/org.eclipse.app4mc.amalthea.converters.080.tests/src/org/eclipse/app4mc/amalthea/converters080/tests/SwConverterTest.java +++ b/tests/org.eclipse.app4mc.amalthea.converters.080.tests/src/org/eclipse/app4mc/amalthea/converters080/tests/SwConverterTest.java
@@ -34,9 +34,9 @@ @Parameterized.Parameters(name = "{index}: Test data ID: {0}. Description : {3}") public static Collection<Object[]> getTestData() { - String[] inputFiles_swModeLabels = new String[] { "/sw/amt_mode.amxmi", "/sw/sw_modelabels.amxmi" }; + String[] inputFilesModeLabels = new String[] { "/sw/amt_mode.amxmi", "/sw/sw_modelabels.amxmi" }; - return Arrays.asList(new Object[][] { { "ModeLabel", true, inputFiles_swModeLabels, + return Arrays.asList(new Object[][] { { "ModeLabel", true, inputFilesModeLabels, "Migration of Amalthea models containing ModeLabels (both simple and cross references)" } }); }
diff --git a/tests/org.eclipse.app4mc.amalthea.converters.081.tests/src/org/eclipse/app4mc/amalthea/converters081/tests/ConstraintsConverterTest.java b/tests/org.eclipse.app4mc.amalthea.converters.081.tests/src/org/eclipse/app4mc/amalthea/converters081/tests/ConstraintsConverterTest.java index f3417a5..924ac71 100644 --- a/tests/org.eclipse.app4mc.amalthea.converters.081.tests/src/org/eclipse/app4mc/amalthea/converters081/tests/ConstraintsConverterTest.java +++ b/tests/org.eclipse.app4mc.amalthea.converters.081.tests/src/org/eclipse/app4mc/amalthea/converters081/tests/ConstraintsConverterTest.java
@@ -31,6 +31,7 @@ import org.eclipse.app4mc.amalthea.converters081.utils.ConstraintElementsCacheBuilder; import org.jdom2.Document; import org.jdom2.Element; +import org.jdom2.Namespace; import org.junit.FixMethodOrder; import org.junit.Test; import org.junit.runner.RunWith; @@ -41,6 +42,13 @@ @RunWith(Parameterized.class) public class ConstraintsConverterTest extends Abstract081ConverterTest { + private static final String VALUE = "value"; + private static final String SCOPE = "scope"; + private static final String CUSTOM_PROPERTIES = "customProperties"; + private static final String EVENT_CHAIN_AMXMI = "eventChain.amxmi"; + + private static final Namespace XSI_NAMESPACE = AmaltheaNamespaceRegistry.getGenericNamespace("xsi"); + @Parameterized.Parameters(name = "{index}: Test data ID: {0}. Description : {3}") public static Collection<Object[]> getTestData() { @@ -114,8 +122,8 @@ * * As a part of migration, following points should be considered:<br> * -- sub EventChain references should not be referred anywhere (as it is not - * valid to have them as per the change in Metamodel from 0.8.1).<br> - * -- Removed reference string of sub eventchain is stored as CustomProperty, + * valid to have them as per the change in meta model from 0.8.1).<br> + * -- Removed reference string of sub event chain is stored as CustomProperty, * inorder to avoid data loss * * @param document @@ -126,9 +134,9 @@ xpathBuffer.append(".//eventChains[ @name=\"eventChain_4\"]"); final List<Element> elements = HelperUtil.getXpathResult(document.getRootElement(), xpathBuffer.toString(), - Element.class, AmaltheaNamespaceRegistry.getGenericNamespace("xsi")); + Element.class, XSI_NAMESPACE); - if (document.getBaseURI().endsWith("eventChain.amxmi")) { + if (document.getBaseURI().endsWith(EVENT_CHAIN_AMXMI)) { /*- * EventChain migrated content: @@ -162,17 +170,17 @@ final Element eventChainReferenceElement = eventChainElement.getChild("strands").getChild("eventChain") .getChildren("segments").get(1).getChild("eventChain").getChild("segments"); - /*- verification of EventChain existance inside EventChainReference */ + /*- verification of EventChain existence inside EventChainReference */ assertNull( "sub EventChain element still exists inside EventChainReference element (which is not allowed as per 0.8.1), is not migrated", eventChainReferenceElement.getChild("eventChain")); - /*- verification of EventChain existance inside EventChainReference */ + /*- verification of EventChain existence inside EventChainReference */ assertEquals("Unable to migrate Sub event chain element references as CustomProperty", "amlt:/#eventChain_from_second_file_sub_element?type=EventChain", - eventChainReferenceElement.getChild("customProperties").getChild("value").getAttributeValue("value")); + eventChainReferenceElement.getChild(CUSTOM_PROPERTIES).getChild(VALUE).getAttributeValue(VALUE)); } } @@ -183,8 +191,8 @@ * EventChain. * * As a part of migration, sub EventChain references should be removed from - * scope (as it is not valid to have them as per the change in Metamodel from - * 0.8.1) Removed references are stored as CustomProperties, inorder to avoid + * scope (as it is not valid to have them as per the change in meta model from + * 0.8.1) Removed references are stored as CustomProperties, in order to avoid * data loss * * @param document @@ -196,9 +204,9 @@ ".//timingConstraints[@xsi:type=\"am:EventChainSynchronizationConstraint\" and @name=\"ecc_1\"]"); final List<Element> elements = HelperUtil.getXpathResult(document.getRootElement(), xpathBuffer.toString(), - Element.class, AmaltheaNamespaceRegistry.getGenericNamespace("xsi")); + Element.class, XSI_NAMESPACE); - if (document.getBaseURI().endsWith("eventChain.amxmi")) { + if (document.getBaseURI().endsWith(EVENT_CHAIN_AMXMI)) { assertEquals("EventChainSynchronizationConstraint element should exists with name : ecc_1", 1, elements.size()); @@ -210,12 +218,12 @@ // input model, as a part of migration content is converted as CustomProperty", assertEquals("Scope contains sub event chain elements (which are not allowed as per 0.8.1)", "eventChain_1?type=EventChain", - eventChainSyncConstraintElement.getAttributeValue("scope")); + eventChainSyncConstraintElement.getAttributeValue(SCOPE)); assertEquals("Unable to migrate Sub event chain element references as CustomProperty", "subeventChain_2?type=EventChain", - eventChainSyncConstraintElement.getChild("customProperties") - .getChild("value").getChild("values").getAttributeValue("value")); + eventChainSyncConstraintElement.getChild(CUSTOM_PROPERTIES) + .getChild(VALUE).getChild("values").getAttributeValue(VALUE)); } } @@ -225,8 +233,8 @@ * EventChain elements are sub EventChain's. * * As a part of migration, sub EventChain references should be removed from - * scope (as it is not valid to have them as per the change in Metamodel from - * 0.8.1) Removed references are stored as CustomProperties, inorder to avoid + * scope (as it is not valid to have them as per the change in meta model from + * 0.8.1) Removed references are stored as CustomProperties, in order to avoid * data loss * * @param document @@ -238,9 +246,9 @@ ".//timingConstraints[@xsi:type=\"am:EventChainSynchronizationConstraint\" and @name=\"ecc2\"]"); final List<Element> elements = HelperUtil.getXpathResult(document.getRootElement(), xpathBuffer.toString(), - Element.class, AmaltheaNamespaceRegistry.getGenericNamespace("xsi")); + Element.class, XSI_NAMESPACE); - if (document.getBaseURI().endsWith("eventChain.amxmi")) { + if (document.getBaseURI().endsWith(EVENT_CHAIN_AMXMI)) { assertEquals("EventChainSynchronizationConstraint element should exists with name : ecc2", 1, elements.size()); @@ -252,13 +260,13 @@ // input model, as a part of migration content is converted as CustomProperty", assertNull( "Scope content is not migrated successfully (In a valid case, scope attribute should be removed as both sub eventchain references are removed)", - eventChainSyncConstraintElement.getAttribute("scope")); + eventChainSyncConstraintElement.getAttribute(SCOPE)); - final List<Element> values = eventChainSyncConstraintElement.getChild("customProperties").getChild("value") + final List<Element> values = eventChainSyncConstraintElement.getChild(CUSTOM_PROPERTIES).getChild(VALUE) .getChildren("values"); assertTrue("Unable to migrate Sub event chain element references as CustomProperty", - values.get(0).getAttributeValue("value").equals("subeventChain_2?type=EventChain") - && values.get(1).getAttributeValue("value").equals("subeventChain_3?type=EventChain")); + values.get(0).getAttributeValue(VALUE).equals("subeventChain_2?type=EventChain") + && values.get(1).getAttributeValue(VALUE).equals("subeventChain_3?type=EventChain")); } } @@ -270,8 +278,8 @@ * elements, one EventChain is a sub EventChain element * * As a part of migration, sub EventChain references should be removed from - * scope (as it is not valid to have them as per the change in Metamodel from - * 0.8.1). Removed references are stored as CustomProperties, inorder to avoid + * scope (as it is not valid to have them as per the change in meta model from + * 0.8.1). Removed references are stored as CustomProperties, in order to avoid * data loss * * @param document @@ -283,9 +291,9 @@ ".//timingConstraints[@xsi:type=\"am:EventChainSynchronizationConstraint\" and @name=\"ecc3\"]"); final List<Element> elements = HelperUtil.getXpathResult(document.getRootElement(), xpathBuffer.toString(), - Element.class, AmaltheaNamespaceRegistry.getGenericNamespace("xsi")); + Element.class, XSI_NAMESPACE); - if (document.getBaseURI().endsWith("eventChain.amxmi")) { + if (document.getBaseURI().endsWith(EVENT_CHAIN_AMXMI)) { assertEquals("EventChainSynchronizationConstraint element should exists with name : ecc3", 1, elements.size()); @@ -294,12 +302,12 @@ assertEquals( "Scope content is not migrated successfully (In a valid case, scope attribute should be removed as both sub eventchain references are removed)", - 2, eventChainSyncConstraintElement.getChildren("scope").size()); + 2, eventChainSyncConstraintElement.getChildren(SCOPE).size()); - final List<Element> values = eventChainSyncConstraintElement.getChild("customProperties").getChild("value").getChildren("values"); + final List<Element> values = eventChainSyncConstraintElement.getChild(CUSTOM_PROPERTIES).getChild(VALUE).getChildren("values"); assertEquals("Unable to migrate Sub event chain element references as CustomProperty", "amlt:/#subeventChain_2?type=EventChain", - values.get(0).getAttributeValue("value")); + values.get(0).getAttributeValue(VALUE)); } } @@ -322,9 +330,9 @@ xpathBuffer.append(".//timingConstraints[@xsi:type=\"am:EventChainLatencyConstraint\" and @name=\"ecl1\"]"); final List<Element> elements = HelperUtil.getXpathResult(document.getRootElement(), xpathBuffer.toString(), - Element.class, AmaltheaNamespaceRegistry.getGenericNamespace("xsi")); + Element.class, XSI_NAMESPACE); - if (document.getBaseURI().endsWith("eventChain.amxmi")) { + if (document.getBaseURI().endsWith(EVENT_CHAIN_AMXMI)) { assertEquals("EventChainLatencyConstraint element should exists with name : ecl1", 1, elements.size()); @@ -332,13 +340,13 @@ assertNull( "Scope content is not migrated successfully (In a valid case, scope attribute should be removed as sub eventchain references are removed)", - eventChainLatencyConstraintElement.getAttribute("scope")); + eventChainLatencyConstraintElement.getAttribute(SCOPE)); - final List<Element> values = eventChainLatencyConstraintElement.getChild("customProperties") - .getChild("value").getChildren("values"); + final List<Element> values = eventChainLatencyConstraintElement.getChild(CUSTOM_PROPERTIES) + .getChild(VALUE).getChildren("values"); assertEquals("Unable to migrate Sub event chain element references as CustomProperty", "strands_subeventchain_2?type=EventChain", - values.get(0).getAttributeValue("value")); + values.get(0).getAttributeValue(VALUE)); } } @@ -351,16 +359,16 @@ xpathBuffer.append(".//timingConstraints[@xsi:type=\"am:EventChainLatencyConstraint\" and @name=\"a\"]"); List<Element> elements = HelperUtil.getXpathResult(document.getRootElement(), xpathBuffer.toString(), - Element.class, AmaltheaNamespaceRegistry.getGenericNamespace("xsi")); + Element.class, XSI_NAMESPACE); - assertTrue("EventChainLatencyConstraint element should exists with name : a", elements.size() == 1); + assertEquals("EventChainLatencyConstraint element should exists with name : a", 1, elements.size()); Element eventChainLatencyConstraintElement = elements.get(0); assertEquals( "Unable to migrate event chain element references for EventChainLatencyConstraint for element \"a\" - due to failure in encoding of the content", "Test+1?type=EventChain", - eventChainLatencyConstraintElement.getAttributeValue("scope")); + eventChainLatencyConstraintElement.getAttributeValue(SCOPE)); // second criteria @@ -369,7 +377,7 @@ xpathBuffer.append(".//timingConstraints[@xsi:type=\"am:EventChainLatencyConstraint\" and @name=\"d\"]"); elements = HelperUtil.getXpathResult(document.getRootElement(), xpathBuffer.toString(), Element.class, - AmaltheaNamespaceRegistry.getGenericNamespace("xsi")); + XSI_NAMESPACE); assertEquals("EventChainLatencyConstraint element should exists with name : d", 1, elements.size()); @@ -377,7 +385,7 @@ assertNull( "Unable to migrate event chain element references for EventChainLatencyConstraint for element \"d\" - due to failure in encoding of the content", - eventChainLatencyConstraintElement.getAttributeValue("scope")); + eventChainLatencyConstraintElement.getAttributeValue(SCOPE)); } } }
diff --git a/tests/org.eclipse.app4mc.amalthea.converters.081.tests/src/org/eclipse/app4mc/amalthea/converters081/tests/HwConverterTest.java b/tests/org.eclipse.app4mc.amalthea.converters.081.tests/src/org/eclipse/app4mc/amalthea/converters081/tests/HwConverterTest.java index c710408..159117e 100644 --- a/tests/org.eclipse.app4mc.amalthea.converters.081.tests/src/org/eclipse/app4mc/amalthea/converters081/tests/HwConverterTest.java +++ b/tests/org.eclipse.app4mc.amalthea.converters.081.tests/src/org/eclipse/app4mc/amalthea/converters081/tests/HwConverterTest.java
@@ -45,12 +45,12 @@ final String[] inputFiles = new String[] { "/hw/hw.amxmi" }; - final String[] inputFiles_quartz = new String[] { "/hw_quartz/hw_quartz.amxmi" }; + final String[] inputFilesQuartz = new String[] { "/hw_quartz/hw_quartz.amxmi" }; return Arrays.asList(new Object[][] { { "Models with HW Model", true, inputFiles, "Migration of Amalthea models containing HW Model " } , - { "Models with HW Model (containing Quartz)", true, inputFiles_quartz, "Migration of Amalthea models containing Quartz in HW Model " } }); + { "Models with HW Model (containing Quartz)", true, inputFilesQuartz, "Migration of Amalthea models containing Quartz in HW Model " } }); } public HwConverterTest(String testDataID, boolean canExecuteTestCase, String[] xmlFiles, String description) {
diff --git a/tests/org.eclipse.app4mc.amalthea.converters.081.tests/src/org/eclipse/app4mc/amalthea/converters081/tests/StimuliConverterTest.java b/tests/org.eclipse.app4mc.amalthea.converters.081.tests/src/org/eclipse/app4mc/amalthea/converters081/tests/StimuliConverterTest.java index c490ab5..0b6ea93 100644 --- a/tests/org.eclipse.app4mc.amalthea.converters.081.tests/src/org/eclipse/app4mc/amalthea/converters081/tests/StimuliConverterTest.java +++ b/tests/org.eclipse.app4mc.amalthea.converters.081.tests/src/org/eclipse/app4mc/amalthea/converters081/tests/StimuliConverterTest.java
@@ -47,13 +47,15 @@ final String[] inputFiles = new String[] { "/stimuli/stimuli.amxmi" }; - final String[] inputFiles_stimuli = new String[] { "/stimuli_event/eventModel.amxmi", "/stimuli_event/eventStimulus.amxmi" }; + final String[] inputFilesStimuli = new String[] { "/stimuli_event/eventModel.amxmi", + "/stimuli_event/eventStimulus.amxmi" }; - return Arrays.asList(new Object[][] { - { "Models with Stimuli Model (Containing ModeValueListEntry elements)", true, inputFiles, "Migration of Amalthea models containing Stimuli model(Containing ModeValueListEntry elements) " } , + return Arrays.asList(new Object[][] { { "Models with Stimuli Model (Containing ModeValueListEntry elements)", + true, inputFiles, + "Migration of Amalthea models containing Stimuli model(Containing ModeValueListEntry elements) " }, - { "Models with Stimuli Model (Containing EventStimulus elements)", true, inputFiles_stimuli, "Migration of Amalthea models containing Stimulus model(Containing EventStimulus elements) " } - }); + { "Models with Stimuli Model (Containing EventStimulus elements)", true, inputFilesStimuli, + "Migration of Amalthea models containing Stimulus model(Containing EventStimulus elements) " } }); } public StimuliConverterTest(String testDataID, boolean canExecuteTestCase, String[] xmlFiles, String description) { @@ -88,36 +90,42 @@ final List<Element> abstractProcessElements = HelperUtil.getXpathResult(document.getRootElement(), xpathBuffer.toString(), Element.class, AmaltheaNamespaceRegistry.getGenericNamespace("xsi")); - if(document.getBaseURI().endsWith("stimuli.amxmi")){ - assertTrue( "Unable to migrate Stimul model containing ModeValueListEntry elements " , abstractProcessElements.size()==4); + if (document.getBaseURI().endsWith("stimuli.amxmi")) { + assertEquals("Unable to migrate Stimul model containing ModeValueListEntry elements ", 4, + abstractProcessElements.size()); } /*-------------- Case 2 -----------------*/ - final StringBuilder xpathBuffer_eventStimulus = new StringBuilder(); + final StringBuilder xpathBufferEventStimulus = new StringBuilder(); - xpathBuffer_eventStimulus.append("./stimuliModel/stimuli[@xsi:type=\"am:EventStimulus\"]"); + xpathBufferEventStimulus.append("./stimuliModel/stimuli[@xsi:type=\"am:EventStimulus\"]"); final List<Element> eventStimulusElements = HelperUtil.getXpathResult(document.getRootElement(), - xpathBuffer_eventStimulus.toString(), Element.class, AmaltheaNamespaceRegistry.getGenericNamespace("xsi")); + xpathBufferEventStimulus.toString(), Element.class, + AmaltheaNamespaceRegistry.getGenericNamespace("xsi")); for (Element eventStimulusElement : eventStimulusElements) { - boolean migStatus_eventStimulus=(eventStimulusElement.getAttribute("trigger") ==null) ||(eventStimulusElement.getChildren("trigger").size()==0); + boolean migStatusEventStimulus = (eventStimulusElement.getAttribute("trigger") == null) + || (eventStimulusElement.getChildren("trigger").size() == 0); - assertTrue( "Unable to migrate Stimul model containing EventStimulus elements " , migStatus_eventStimulus); + assertTrue("Unable to migrate Stimul model containing EventStimulus elements ", migStatusEventStimulus); } - if(document.getBaseURI().endsWith("eventStimulus.amxmi")){ + if (document.getBaseURI().endsWith("eventStimulus.amxmi")) { - final List<Element> custProps_ObjRefs = HelperUtil.getXpathResult(document.getRootElement(), - ".//customProperties[@key=\"st3\"]/value/values/values/values/values/values/value", Element.class, AmaltheaNamespaceRegistry.getGenericNamespace("xsi")); + final List<Element> custPropsObjRefs = HelperUtil.getXpathResult(document.getRootElement(), + ".//customProperties[@key=\"st3\"]/value/values/values/values/values/values/value", Element.class, + AmaltheaNamespaceRegistry.getGenericNamespace("xsi")); - assertEquals("Expected to have CustomProperty", 1, custProps_ObjRefs.size()); + assertEquals("Expected to have CustomProperty", 1, custPropsObjRefs.size()); - String hrefValue = custProps_ObjRefs.get(0).getAttributeValue("href"); + String hrefValue = custPropsObjRefs.get(0).getAttributeValue("href"); - assertEquals("Stimulus reference not migrated", "amlt:/#foreignStimuli?type=InterProcessStimulus", hrefValue); + assertEquals("Stimulus reference not migrated", "amlt:/#foreignStimuli?type=InterProcessStimulus", + hrefValue); } } + }
diff --git a/tests/org.eclipse.app4mc.amalthea.converters.081.tests/src/org/eclipse/app4mc/amalthea/converters081/tests/SwConverterTest.java b/tests/org.eclipse.app4mc.amalthea.converters.081.tests/src/org/eclipse/app4mc/amalthea/converters081/tests/SwConverterTest.java index 4f90d2e..e8f6821 100644 --- a/tests/org.eclipse.app4mc.amalthea.converters.081.tests/src/org/eclipse/app4mc/amalthea/converters081/tests/SwConverterTest.java +++ b/tests/org.eclipse.app4mc.amalthea.converters.081.tests/src/org/eclipse/app4mc/amalthea/converters081/tests/SwConverterTest.java
@@ -43,15 +43,18 @@ @Parameterized.Parameters(name = "{index}: Test data ID: {0}. Description : {3}") public static Collection<Object[]> getTestData() { - final String[] inputFiles = new String[] { "/sw/sw.amxmi","/sw/sw2.amxmi" }; - final String[] inputFiles_priority = new String[] { "/sw_priority/sw_priority.amxmi" }; - final String[] inputFiles_activations = new String[] { "/activations/events.amxmi" , "/activations/sw_activations.amxmi"}; + final String[] inputFiles = new String[] { "/sw/sw.amxmi", "/sw/sw2.amxmi" }; + final String[] inputFilesPriority = new String[] { "/sw_priority/sw_priority.amxmi" }; + final String[] inputFilesActivations = new String[] { "/activations/events.amxmi", + "/activations/sw_activations.amxmi" }; return Arrays.asList(new Object[][] { - { "Models with SW Model", true, inputFiles, "Migration of Amalthea models containing SW Model " } , - { "Models with SW Model - having sub-classes of AbstractProcess (e.g: Task, ISR, ProcessPrototyes)", true, inputFiles_priority, "Migration of Amalthea models containing SW Model (with AbstractProcess elements)"}, - { "Models with Activations & Triggers", true, inputFiles_activations, "Migration of Amalthea models containing PeriodicActivation's & EventActivation's " } - }); + { "Models with SW Model", true, inputFiles, "Migration of Amalthea models containing SW Model " }, + { "Models with SW Model - having sub-classes of AbstractProcess (e.g: Task, ISR, ProcessPrototyes)", + true, inputFilesPriority, + "Migration of Amalthea models containing SW Model (with AbstractProcess elements)" }, + { "Models with Activations & Triggers", true, inputFilesActivations, + "Migration of Amalthea models containing PeriodicActivation's & EventActivation's " } }); } public SwConverterTest(String testDataID, boolean canExecuteTestCase, String[] xmlFiles, String description) { @@ -75,14 +78,14 @@ super.modelFileVerificationHook(document); final List<Element> runnableElements = HelperUtil.getXpathResult(document.getRootElement(), - "./swModel/runnables[./activations]|./swModel/runnables[@activations]", Element.class, AmaltheaNamespaceRegistry.getGenericNamespace("xsi")); + "./swModel/runnables[./activations]|./swModel/runnables[@activations]", Element.class, + AmaltheaNamespaceRegistry.getGenericNamespace("xsi")); - - if (document.getBaseURI().endsWith("sw.amxmi")){ - assertEquals( "Runnable migration is not successful" , runnableElements.size(), 2); + if (document.getBaseURI().endsWith("sw.amxmi")) { + assertEquals("Runnable migration is not successful", 2, runnableElements.size()); } - //check for priority inside AbstractProcessElements + // check for priority inside AbstractProcessElements final StringBuilder absProcessXpathBuffer = new StringBuilder(); @@ -95,23 +98,29 @@ final List<Element> abstractProcessElements = HelperUtil.getXpathResult(document.getRootElement(), absProcessXpathBuffer.toString(), Element.class, AmaltheaNamespaceRegistry.getGenericNamespace("xsi")); - assertEquals( "Priority from AbstractProcess elements is not migrated properly", 0, abstractProcessElements.size()); + assertEquals("Priority from AbstractProcess elements is not migrated properly", 0, + abstractProcessElements.size()); - //check for priority inside TaskAllocation + // check for priority inside TaskAllocation final List<Element> taskAllocationElements = HelperUtil.getXpathResult(document.getRootElement(), - "./mappingModel/taskAllocation[@priority]", Element.class, AmaltheaNamespaceRegistry.getGenericNamespace("xsi")); + "./mappingModel/taskAllocation[@priority]", Element.class, + AmaltheaNamespaceRegistry.getGenericNamespace("xsi")); - assertEquals( "Priority from TaskAllocation elements is not migrated properly", 0, taskAllocationElements.size()); + assertEquals("Priority from TaskAllocation elements is not migrated properly", 0, + taskAllocationElements.size()); final List<Element> deadlineElements = HelperUtil.getXpathResult(document.getRootElement(), - "./swModel/activations[@xsi:type=\"am:PeriodicActivation\"]/deadline", Element.class, AmaltheaNamespaceRegistry.getGenericNamespace("xsi")); + "./swModel/activations[@xsi:type=\"am:PeriodicActivation\"]/deadline", Element.class, + AmaltheaNamespaceRegistry.getGenericNamespace("xsi")); - assertEquals( "PeriodicActivation is not migrated w.r.t. deadline", 0, deadlineElements.size()); + assertEquals("PeriodicActivation is not migrated w.r.t. deadline", 0, deadlineElements.size()); final List<Element> triggerElements = HelperUtil.getXpathResult(document.getRootElement(), - "./swModel/activations[@xsi:type=\"am:EventActivation\"]/deadline", Element.class, AmaltheaNamespaceRegistry.getGenericNamespace("xsi")); + "./swModel/activations[@xsi:type=\"am:EventActivation\"]/deadline", Element.class, + AmaltheaNamespaceRegistry.getGenericNamespace("xsi")); - assertEquals( "EventActivation is not migrated w.r.t. trigger", 0, triggerElements.size()); + assertEquals("EventActivation is not migrated w.r.t. trigger", 0, triggerElements.size()); } + }
diff --git a/tests/org.eclipse.app4mc.amalthea.converters.097.tests/src/org/eclipse/app4mc/amalthea/converters097/tests/ComponentsModelConverterTest.java b/tests/org.eclipse.app4mc.amalthea.converters.097.tests/src/org/eclipse/app4mc/amalthea/converters097/tests/ComponentsModelConverterTest.java index d9db9e2..e674905 100644 --- a/tests/org.eclipse.app4mc.amalthea.converters.097.tests/src/org/eclipse/app4mc/amalthea/converters097/tests/ComponentsModelConverterTest.java +++ b/tests/org.eclipse.app4mc.amalthea.converters.097.tests/src/org/eclipse/app4mc/amalthea/converters097/tests/ComponentsModelConverterTest.java
@@ -46,6 +46,8 @@ @RunWith(Parameterized.class) public class ComponentsModelConverterTest extends Abstract097ConverterTest { + private static final String INSTANCE = "instance"; + @Parameterized.Parameters(name = "{index}: Test file: {0}") public static Collection<Object[]> getTestData() { @@ -103,14 +105,14 @@ if (element.getAttribute("name").getValue().equals("")) { Element child = element.getChild("sourcePort"); assertNotNull(child); - assertEquals("Composite1/CompositeComp?type=ComponentInstance", child.getAttribute("instance").getValue()); + assertEquals("Composite1/CompositeComp?type=ComponentInstance", child.getAttribute(INSTANCE).getValue()); child = element.getChild("targetPort"); assertNotNull(child); - assertEquals("Composite1/CompositeComp?type=ComponentInstance", child.getAttribute("instance").getValue()); + assertEquals("Composite1/CompositeComp?type=ComponentInstance", child.getAttribute(INSTANCE).getValue()); } else if (element.getAttribute("name").getValue().equals("con")) { Element child = element.getChild("sourcePort"); assertNotNull(child); - assertEquals("abc%3E%3Edef/inst+1?type=ComponentInstance", child.getAttribute("instance").getValue()); + assertEquals("abc%3E%3Edef/inst+1?type=ComponentInstance", child.getAttribute(INSTANCE).getValue()); } } }
diff --git a/tests/org.eclipse.app4mc.amalthea.converters.common.tests/src/org/eclipse/app4mc/amalthea/converters/common/tests/AbstractConverterTest.java b/tests/org.eclipse.app4mc.amalthea.converters.common.tests/src/org/eclipse/app4mc/amalthea/converters/common/tests/AbstractConverterTest.java index 7ccdae2..6e98ec6 100644 --- a/tests/org.eclipse.app4mc.amalthea.converters.common.tests/src/org/eclipse/app4mc/amalthea/converters/common/tests/AbstractConverterTest.java +++ b/tests/org.eclipse.app4mc.amalthea.converters.common.tests/src/org/eclipse/app4mc/amalthea/converters/common/tests/AbstractConverterTest.java
@@ -53,6 +53,9 @@ public abstract class AbstractConverterTest { + private static final String XMI = "xmi"; + private static final String AMXMI = "amxmi"; + public static final String GLOBAL_TEST_INPUT_DIRECTORY = "./TestModels/input"; public static final String GLOBAL_TEST_OUTPUT_DIRECTORY = "./TestModels/output"; @@ -122,7 +125,7 @@ if (!targetFile.exists()) { String fileExtension = targetFile.getName().substring(targetFile.getName().lastIndexOf('.') + 1); - if (!fileExtension.equalsIgnoreCase("amxmi")) { + if (!fileExtension.equalsIgnoreCase(AMXMI)) { targetFile = new File(outputFilePath + ".amxmi"); } } @@ -224,7 +227,7 @@ final String prefix = namespace.getPrefix(); - if (prefix.equals("xmlns") || prefix.equals("xmi") || prefix.equals("xsi") || prefix.equals("") + if (prefix.equals("xmlns") || prefix.equals(XMI) || prefix.equals("xsi") || prefix.equals("") || prefix.equals("xml")) { continue; } @@ -267,7 +270,7 @@ final int indexOfDot = convertedFileName.lastIndexOf('.'); final String extension = convertedFileName.substring(indexOfDot + 1); - if (extension.startsWith("amxmi") && !extension.equals("amxmi")) { + if (extension.startsWith(AMXMI) && !extension.equals(AMXMI)) { convertedFileName = convertedFileName + ".amxmi"; } }
diff --git a/tests/org.eclipse.app4mc.amalthea.converters.common.tests/src/org/eclipse/app4mc/amalthea/converters/common/tests/AmaltheaNamespaceRegistryTest.java b/tests/org.eclipse.app4mc.amalthea.converters.common.tests/src/org/eclipse/app4mc/amalthea/converters/common/tests/AmaltheaNamespaceRegistryTest.java index cde515f..d1abdc5 100644 --- a/tests/org.eclipse.app4mc.amalthea.converters.common.tests/src/org/eclipse/app4mc/amalthea/converters/common/tests/AmaltheaNamespaceRegistryTest.java +++ b/tests/org.eclipse.app4mc.amalthea.converters.common.tests/src/org/eclipse/app4mc/amalthea/converters/common/tests/AmaltheaNamespaceRegistryTest.java
@@ -24,6 +24,11 @@ public class AmaltheaNamespaceRegistryTest { + private static final String HTTP_AMALTHEA_0_7_0 = "http://app4mc.eclipse.org/amalthea/0.7.0"; + private static final String HTTP_AMALTHEA_0_7_1 = "http://app4mc.eclipse.org/amalthea/0.7.1"; + private static final String HTTP_AMALTHEA_0_7_2 = "http://app4mc.eclipse.org/amalthea/0.7.2"; + private static final String HTTP_AMALTHEA_0_8_0 = "http://app4mc.eclipse.org/amalthea/0.8.0"; + @Test public void shouldReturnNamespacesBefore() { Namespace[] allNamespacesBefore = AmaltheaNamespaceRegistry.getAllNamespacesBefore(ModelVersion.VERSION_080, false, false); @@ -31,11 +36,11 @@ assertEquals(3, allNamespacesBefore.length); assertEquals("am", allNamespacesBefore[0].getPrefix()); - assertEquals("http://app4mc.eclipse.org/amalthea/0.7.0", allNamespacesBefore[0].getURI()); + assertEquals(HTTP_AMALTHEA_0_7_0, allNamespacesBefore[0].getURI()); assertEquals("am", allNamespacesBefore[1].getPrefix()); - assertEquals("http://app4mc.eclipse.org/amalthea/0.7.1", allNamespacesBefore[1].getURI()); + assertEquals(HTTP_AMALTHEA_0_7_1, allNamespacesBefore[1].getURI()); assertEquals("am", allNamespacesBefore[2].getPrefix()); - assertEquals("http://app4mc.eclipse.org/amalthea/0.7.2", allNamespacesBefore[2].getURI()); + assertEquals(HTTP_AMALTHEA_0_7_2, allNamespacesBefore[2].getURI()); } @Test @@ -45,13 +50,13 @@ assertEquals(4, allNamespacesBefore.length); assertEquals("am", allNamespacesBefore[0].getPrefix()); - assertEquals("http://app4mc.eclipse.org/amalthea/0.7.0", allNamespacesBefore[0].getURI()); + assertEquals(HTTP_AMALTHEA_0_7_0, allNamespacesBefore[0].getURI()); assertEquals("am", allNamespacesBefore[1].getPrefix()); - assertEquals("http://app4mc.eclipse.org/amalthea/0.7.1", allNamespacesBefore[1].getURI()); + assertEquals(HTTP_AMALTHEA_0_7_1, allNamespacesBefore[1].getURI()); assertEquals("am", allNamespacesBefore[2].getPrefix()); - assertEquals("http://app4mc.eclipse.org/amalthea/0.7.2", allNamespacesBefore[2].getURI()); + assertEquals(HTTP_AMALTHEA_0_7_2, allNamespacesBefore[2].getURI()); assertEquals("am", allNamespacesBefore[3].getPrefix()); - assertEquals("http://app4mc.eclipse.org/amalthea/0.8.0", allNamespacesBefore[3].getURI()); + assertEquals(HTTP_AMALTHEA_0_8_0, allNamespacesBefore[3].getURI()); } @Test @@ -67,12 +72,12 @@ assertEquals("http://www.omg.org/XMI", allNamespacesBefore[1].getURI()); assertEquals("am", allNamespacesBefore[2].getPrefix()); - assertEquals("http://app4mc.eclipse.org/amalthea/0.7.0", allNamespacesBefore[2].getURI()); + assertEquals(HTTP_AMALTHEA_0_7_0, allNamespacesBefore[2].getURI()); assertEquals("am", allNamespacesBefore[3].getPrefix()); - assertEquals("http://app4mc.eclipse.org/amalthea/0.7.1", allNamespacesBefore[3].getURI()); + assertEquals(HTTP_AMALTHEA_0_7_1, allNamespacesBefore[3].getURI()); assertEquals("am", allNamespacesBefore[4].getPrefix()); - assertEquals("http://app4mc.eclipse.org/amalthea/0.7.2", allNamespacesBefore[4].getURI()); + assertEquals(HTTP_AMALTHEA_0_7_2, allNamespacesBefore[4].getURI()); assertEquals("am", allNamespacesBefore[5].getPrefix()); - assertEquals("http://app4mc.eclipse.org/amalthea/0.8.0", allNamespacesBefore[5].getURI()); + assertEquals(HTTP_AMALTHEA_0_8_0, allNamespacesBefore[5].getURI()); } }