diff --git a/.gitignore b/.gitignore index 2f7896d1d13..048c68bb97c 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ target/ +.DS_Store \ No newline at end of file diff --git a/analyses/org.osate.analysis.flows.tests/.classpath b/analyses/org.osate.analysis.flows.tests/.classpath index ef58158d611..9e313b57727 100644 --- a/analyses/org.osate.analysis.flows.tests/.classpath +++ b/analyses/org.osate.analysis.flows.tests/.classpath @@ -1,6 +1,6 @@ - + diff --git a/analyses/org.osate.analysis.flows.tests/.settings/org.eclipse.jdt.core.prefs b/analyses/org.osate.analysis.flows.tests/.settings/org.eclipse.jdt.core.prefs index 9f6ece88bdf..d4540a53f99 100644 --- a/analyses/org.osate.analysis.flows.tests/.settings/org.eclipse.jdt.core.prefs +++ b/analyses/org.osate.analysis.flows.tests/.settings/org.eclipse.jdt.core.prefs @@ -1,8 +1,10 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=17 +org.eclipse.jdt.core.compiler.compliance=17 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.release=disabled -org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=17 diff --git a/analyses/org.osate.analysis.flows.tests/META-INF/MANIFEST.MF b/analyses/org.osate.analysis.flows.tests/META-INF/MANIFEST.MF index edeeab19064..4d16e572fb8 100644 --- a/analyses/org.osate.analysis.flows.tests/META-INF/MANIFEST.MF +++ b/analyses/org.osate.analysis.flows.tests/META-INF/MANIFEST.MF @@ -32,7 +32,7 @@ Import-Package: org.apache.commons.logging, org.junit.runner.notification;version="4.5.0", org.junit.runners;version="4.5.0", org.junit.runners.model;version="4.5.0" -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-RequiredExecutionEnvironment: JavaSE-17 Bundle-Activator: org.osate.xtext.aadl2.ui.internal.Aadl2Activator Bundle-ActivationPolicy: lazy Automatic-Module-Name: org.osate.analysis.flows.tests diff --git a/analyses/org.osate.analysis.flows.tests/models/issue2885/.gitignore b/analyses/org.osate.analysis.flows.tests/models/issue2885/.gitignore new file mode 100644 index 00000000000..f7c785bb7f1 --- /dev/null +++ b/analyses/org.osate.analysis.flows.tests/models/issue2885/.gitignore @@ -0,0 +1,3 @@ +/.aadlbin-gen/ +instances/ +/.settings/ \ No newline at end of file diff --git a/analyses/org.osate.analysis.flows.tests/models/issue2885/.project b/analyses/org.osate.analysis.flows.tests/models/issue2885/.project new file mode 100644 index 00000000000..89d5573c655 --- /dev/null +++ b/analyses/org.osate.analysis.flows.tests/models/issue2885/.project @@ -0,0 +1,18 @@ + + + Issue2885 + + + + + + org.eclipse.xtext.ui.shared.xtextBuilder + + + + + + org.osate.core.aadlnature + org.eclipse.xtext.ui.shared.xtextNature + + diff --git a/analyses/org.osate.analysis.flows.tests/models/issue2885/Issue2885.aadl b/analyses/org.osate.analysis.flows.tests/models/issue2885/Issue2885.aadl new file mode 100644 index 00000000000..524dd9b33b8 --- /dev/null +++ b/analyses/org.osate.analysis.flows.tests/models/issue2885/Issue2885.aadl @@ -0,0 +1,55 @@ +package Issue2885 +public + feature group FG + end FG; + + system A + end A; + + system implementation A.impl + subcomponents + c: abstract C; + m: system M; + s: system S; + connections + m_to_c: feature group m.p1 -> c.p1; + s_to_m: feature group s.p2 -> m.p2; + flows + Sensor_Flow: end to end flow + s.flowSource -> + s_to_m -> + m.flowPath -> + m_to_c -> + c.flowSink; + properties + Latency => 100 ms .. 200 ms applies to Sensor_Flow; + end A.impl; + + abstract C + features + p1: feature group inverse of FG; + flows + flowSink: flow sink p1; + properties + Latency => 0 ms .. 25 ms applies to flowSink; + end C; + + system M + features + p1: feature group FG; + p2: feature group inverse of FG; + flows + flowPath: flow path p2 -> p1; + properties + Latency => 100 ms .. 100 ms applies to flowPath; + end M; + + system S + features + p2: feature group FG; + flows + flowSource: flow source p2; + properties + Latency => 0 ms .. 25 ms applies to flowSource; + end S; +end Issue2885; diff --git a/analyses/org.osate.analysis.flows.tests/src/org/osate/analysis/flows/tests/Issue2885Test.java b/analyses/org.osate.analysis.flows.tests/src/org/osate/analysis/flows/tests/Issue2885Test.java new file mode 100644 index 00000000000..f4b5bf89587 --- /dev/null +++ b/analyses/org.osate.analysis.flows.tests/src/org/osate/analysis/flows/tests/Issue2885Test.java @@ -0,0 +1,79 @@ +/** + * Copyright (c) 2004-2023 Carnegie Mellon University and others. (see Contributors file). + * All Rights Reserved. + * + * NO WARRANTY. ALL MATERIAL IS FURNISHED ON AN "AS-IS" BASIS. CARNEGIE MELLON UNIVERSITY MAKES NO WARRANTIES OF ANY + * KIND, EITHER EXPRESSED OR IMPLIED, AS TO ANY MATTER INCLUDING, BUT NOT LIMITED TO, WARRANTY OF FITNESS FOR PURPOSE + * OR MERCHANTABILITY, EXCLUSIVITY, OR RESULTS OBTAINED FROM USE OF THE MATERIAL. CARNEGIE MELLON UNIVERSITY DOES NOT + * MAKE ANY WARRANTY OF ANY KIND WITH RESPECT TO FREEDOM FROM PATENT, TRADEMARK, OR COPYRIGHT INFRINGEMENT. + * + * This program and the accompanying materials are made available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * SPDX-License-Identifier: EPL-2.0 + * + * Created, in part, with funding and support from the United States Government. (see Acknowledgments file). + * + * This program includes and/or can make use of certain third party source code, object code, documentation and other + * files ("Third Party Software"). The Third Party Software that is used by this program is dependent upon your system + * configuration. By using this program, You agree to comply with any and all relevant Third Party Software terms and + * conditions contained in any such Third Party Software or separate license file distributed with such Third Party + * Software. The parties who own the Third Party Software ("Third Party Licensors") are intended third party benefici- + * aries to this license with respect to the terms applicable to their Third Party Software. Third Party Software li- + * censes only apply to the Third Party Software and not any other portion of this program or this program as a whole. + */ +package org.osate.analysis.flows.tests; + +import java.util.Optional; + +import org.eclipse.xtext.testing.InjectWith; +import org.eclipse.xtext.testing.XtextRunner; +import org.eclipse.xtext.testing.validation.ValidationTestHelper; +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.osate.aadl2.AadlPackage; +import org.osate.aadl2.Classifier; +import org.osate.aadl2.ComponentImplementation; +import org.osate.aadl2.instance.SystemInstance; +import org.osate.aadl2.instantiation.InstantiateModel; +import org.osate.analysis.flows.FlowLatencyAnalysisSwitch; +import org.osate.testsupport.Aadl2InjectorProvider; +import org.osate.testsupport.TestHelper; + +import com.google.inject.Inject; +import com.itemis.xtext.testing.XtextTest; + +@RunWith(XtextRunner.class) +@InjectWith(Aadl2InjectorProvider.class) +public class Issue2885Test extends XtextTest { + + private static final String FILE = "org.osate.analysis.flows.tests/models/issue2885/Issue2885.aadl"; + + @Inject + TestHelper testHelper; + + @Inject + private ValidationTestHelper validationHelper; + + @Test + public void testAnalysis() throws Exception { + AadlPackage pkg = testHelper.parseFile(FILE); + + validationHelper.assertNoIssues(pkg); + + Optional impl = pkg.getOwnedPublicSection() + .getOwnedClassifiers() + .stream() + .filter(c -> c.getName().equals("A.impl")) + .findFirst(); + + SystemInstance instance = InstantiateModel.instantiate((ComponentImplementation) impl.get()); + Assert.assertEquals("A_impl_Instance", instance.getName()); + + // check flow latency + var som = instance.getSystemOperationModes().get(0); + var checker = new FlowLatencyAnalysisSwitch(); + checker.invoke(instance, som, true, true, true, true, false); + } + +} diff --git a/analyses/org.osate.analysis.flows/META-INF/MANIFEST.MF b/analyses/org.osate.analysis.flows/META-INF/MANIFEST.MF index a39fc701fb3..c9271edda1e 100644 --- a/analyses/org.osate.analysis.flows/META-INF/MANIFEST.MF +++ b/analyses/org.osate.analysis.flows/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: %pluginName Bundle-SymbolicName: org.osate.analysis.flows;singleton:=true -Bundle-Version: 5.0.5.qualifier +Bundle-Version: 5.0.6.qualifier Bundle-Activator: org.osate.analysis.flows.FlowanalysisPlugin Bundle-Vendor: CMU/SEI Bundle-Localization: plugin diff --git a/analyses/org.osate.analysis.flows/pom.xml b/analyses/org.osate.analysis.flows/pom.xml index 42897b5dbc9..d32bc20bfc7 100644 --- a/analyses/org.osate.analysis.flows/pom.xml +++ b/analyses/org.osate.analysis.flows/pom.xml @@ -12,7 +12,7 @@ org.osate org.osate.analysis.flows - 5.0.5-SNAPSHOT + 5.0.6-SNAPSHOT eclipse-plugin diff --git a/analyses/org.osate.analysis.flows/src/org/osate/analysis/flows/FlowLatencyAnalysisSwitch.java b/analyses/org.osate.analysis.flows/src/org/osate/analysis/flows/FlowLatencyAnalysisSwitch.java index 1f6e14589cf..b0a48890119 100644 --- a/analyses/org.osate.analysis.flows/src/org/osate/analysis/flows/FlowLatencyAnalysisSwitch.java +++ b/analyses/org.osate.analysis.flows/src/org/osate/analysis/flows/FlowLatencyAnalysisSwitch.java @@ -539,8 +539,7 @@ private void mapConnectionInstance(final EndToEndFlowInstance etef, final FlowEl report.isMajorFrameDelay()); processActualConnectionBindingsSampling(connectionInstance, latencyContributor); - ComponentClassifier relatedConnectionData = (ComponentClassifier) FlowLatencyUtil - .getConnectionData(connectionInstance); + ComponentClassifier relatedConnectionData = FlowLatencyUtil.getConnectionData(connectionInstance); processActualConnectionBindingsTransmission(connectionInstance, relatedConnectionData == null ? 0.0 : AadlContribUtils.getDataSize(relatedConnectionData, SizeUnits.BYTES), diff --git a/analyses/org.osate.analysis.flows/src/org/osate/analysis/flows/internal/utils/FlowLatencyUtil.java b/analyses/org.osate.analysis.flows/src/org/osate/analysis/flows/internal/utils/FlowLatencyUtil.java index 4a412c2b2d4..811ee2d061b 100644 --- a/analyses/org.osate.analysis.flows/src/org/osate/analysis/flows/internal/utils/FlowLatencyUtil.java +++ b/analyses/org.osate.analysis.flows/src/org/osate/analysis/flows/internal/utils/FlowLatencyUtil.java @@ -35,7 +35,6 @@ import org.eclipse.emf.ecore.resource.Resource; import org.eclipse.emf.ecore.util.EcoreUtil; import org.eclipse.ui.statushandlers.StatusManager; -import org.osate.aadl2.Classifier; import org.osate.aadl2.ComponentCategory; import org.osate.aadl2.ComponentClassifier; import org.osate.aadl2.ComponentType; @@ -50,6 +49,7 @@ import org.osate.aadl2.instance.ConnectionInstanceEnd; import org.osate.aadl2.instance.ConnectionKind; import org.osate.aadl2.instance.EndToEndFlowInstance; +import org.osate.aadl2.instance.FeatureCategory; import org.osate.aadl2.instance.FeatureInstance; import org.osate.aadl2.instance.FlowElementInstance; import org.osate.aadl2.instance.FlowSpecificationInstance; @@ -236,14 +236,17 @@ public static double getPartitionPeriod(final ComponentInstance part) { return result; } - public static Classifier getConnectionData(ConnectionInstance connectionInstance) { + public static ComponentClassifier getConnectionData(ConnectionInstance connectionInstance) { ConnectionInstanceEnd cei; FeatureInstance fi; cei = connectionInstance.getSource(); if (cei instanceof FeatureInstance) { fi = (FeatureInstance) cei; - return fi.getFeature().getAllClassifier(); + if (fi.getCategory() == FeatureCategory.FEATURE_GROUP) { + return null; + } + return (ComponentClassifier) fi.getFeature().getAllClassifier(); } return null; diff --git a/analyses/org.osate.plugins.feature/feature.xml b/analyses/org.osate.plugins.feature/feature.xml index b7ffe60cd67..2207e1a0947 100644 --- a/analyses/org.osate.plugins.feature/feature.xml +++ b/analyses/org.osate.plugins.feature/feature.xml @@ -2,7 +2,7 @@ org.osate org.osate.plugins.feature - 6.1.6-SNAPSHOT + 6.1.7-SNAPSHOT eclipse-feature diff --git a/core/org.osate.build.coverage.report/pom.xml b/core/org.osate.build.coverage.report/pom.xml index 079a5d1c375..0b681a4ef7b 100644 --- a/core/org.osate.build.coverage.report/pom.xml +++ b/core/org.osate.build.coverage.report/pom.xml @@ -143,7 +143,7 @@ org.osate org.osate.analysis.flows - 5.0.5-SNAPSHOT + 5.0.6-SNAPSHOT true compile