Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions analyses/org.osate.modelstats.tests/.classpath
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src">
<attributes>
<attribute name="test" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="bin"/>
</classpath>
1 change: 1 addition & 0 deletions analyses/org.osate.modelstats.tests/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/bin/
28 changes: 28 additions & 0 deletions analyses/org.osate.modelstats.tests/.project
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>org.osate.modelstats.tests</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.ManifestBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.SchemaBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.pde.PluginNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
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.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.release=disabled
org.eclipse.jdt.core.compiler.source=1.8
18 changes: 18 additions & 0 deletions analyses/org.osate.modelstats.tests/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Model Statistics Tests
Bundle-SymbolicName: org.osate.modelstats.tests
Bundle-Version: 1.0.0.qualifier
Bundle-Activator: org.osate.modelstats.tests.Activator
Require-Bundle: org.eclipse.core.runtime,
org.osate.modelstats;bundle-version="1.0.0",
org.eclipse.xtext.testing,
org.eclipse.xtext.junit4,
org.junit,
org.osate.testsupport,
org.osate.aadl2,
org.osate.aadl2.instantiation
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Automatic-Module-Name: org.osate.componentcounter.tests
Bundle-ActivationPolicy: lazy
Bundle-Vendor: CMU/SEI
4 changes: 4 additions & 0 deletions analyses/org.osate.modelstats.tests/build.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
source.. = src/
output.. = bin/
bin.includes = META-INF/,\
.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/.aadlbin-gen/
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>ComponentCounter</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.xtext.ui.shared.xtextBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.osate.core.aadlnature</nature>
<nature>org.eclipse.xtext.ui.shared.xtextNature</nature>
</natures>
</projectDescription>
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package Empty
public
system s
end s;

system implementation s.impl
end s.impl;
end Empty;
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
package Exhaustive
public
system s
end s;

system implementation s.impl
subcomponents
sub1: abstract;
sub2: bus;
sub3: data;
sub4: device;
sub5: memory;
sub6: process p.impl;
sub7: processor;
sub8: subprogram;
sub9: subprogram group;
sub10: system;
sub11: virtual bus;
sub12: virtual processor;
end s.impl;

process p
end p;

process implementation p.impl
subcomponents
sub13: thread group;
t1: thread t1;
t2: thread t2;
connections
con1: feature t1.f1 -> t2.f2;
flows
flow1: end to end flow t1.source1 -> con1 -> t2.sink2;
end p.impl;

thread t1
features
f1: feature;
flows
source1: flow source f1;
end t1;

thread t2
features
f2: feature;
flows
sink2: flow sink f2;
end t2;
end Exhaustive;
66 changes: 66 additions & 0 deletions analyses/org.osate.modelstats.tests/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>org.osate</groupId>
<artifactId>analyses.parent</artifactId>
<version>2.9.0-SNAPSHOT</version>
</parent>

<groupId>org.osate</groupId>
<artifactId>org.osate.modelstats.tests</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>eclipse-test-plugin</packaging>

<repositories>
<repository>
<id>eclipse</id>
<url>${eclipse.repo.url}</url>
<layout>p2</layout>
</repository>
<repository>
<id>xtext-testing</id>
<url>${xtext-testing.repo.url}</url>
<layout>p2</layout>
</repository>
</repositories>
<build>
<plugins>
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>target-platform-configuration</artifactId>
<version>${tycho.version}</version>
<configuration>
<!-- additional requirements for running the tests -->
<!-- adding them here works, adding them in surefire configuration as -->
<!-- dependency works only if the tests are started in the test plugin
directory -->
<dependency-resolution>
<extraRequirements>
<requirement>
<type>eclipse-plugin</type>
<id>org.eclipse.equinox.event</id>
<versionRange>0.0.0</versionRange>
</requirement>
<requirement>
<type>eclipse-plugin</type>
<id>org.eclipse.equinox.ds</id>
<versionRange>0.0.0</versionRange>
</requirement>
<requirement>
<!-- for transactional editing domain that is needed during instantiation -->
<type>eclipse-plugin</type>
<id>org.osate.aadl2.model.editor</id>
<versionRange>0.0.0</versionRange>
</requirement>
</extraRequirements>
</dependency-resolution>
</configuration>
</plugin>
</plugins>
</build>

</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package org.osate.modelstats.tests;

import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;

public class Activator implements BundleActivator {

private static BundleContext context;

static BundleContext getContext() {
return context;
}

public void start(BundleContext bundleContext) throws Exception {
Activator.context = bundleContext;
}

public void stop(BundleContext bundleContext) throws Exception {
Activator.context = null;
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
package org.osate.modelstats.tests;

import org.eclipse.xtext.testing.InjectWith;
import org.eclipse.xtext.testing.XtextRunner;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.osate.aadl2.AadlPackage;
import org.osate.aadl2.ComponentCategory;
import org.osate.aadl2.SystemImplementation;
import org.osate.aadl2.instance.SystemInstance;
import org.osate.aadl2.instantiation.InstantiateModel;
import org.osate.modelstats.ComponentCounter;
import org.osate.modelstats.ElementsCounts;
import org.osate.testsupport.Aadl2InjectorProvider;
import org.osate.testsupport.TestHelper;

import com.google.inject.Inject;


@RunWith(XtextRunner.class)
@InjectWith(Aadl2InjectorProvider.class)
public class ComponentCounterTest {
private final String path = "org.osate.modelstats.tests/models/ComponentCounter/";

@Inject
private TestHelper<AadlPackage> testHelper;

@Test
public void emptyTest() throws Exception {
AadlPackage pkg = testHelper.parseFile(path + "Empty.aadl");
SystemImplementation impl = (SystemImplementation) pkg.getPublicSection().getOwnedClassifiers().get(1);
SystemInstance si = InstantiateModel.instantiate(impl);
ElementsCounts elementCounts = ComponentCounter.countComponents(si);

Assert.assertEquals(1, elementCounts.getTotalComponentCount());
Assert.assertEquals(0, elementCounts.getConnectionsCount());
Assert.assertEquals(0, elementCounts.getEndToEndFlowsCount());
Assert.assertEquals(1, elementCounts.getComponentCountMap().size());
Assert.assertEquals(1, elementCounts.getComponentCountMap().get(ComponentCategory.SYSTEM).intValue());
}

@Test
public void exhaustiveTest() throws Exception {
AadlPackage pkg = testHelper.parseFile(path + "Exhaustive.aadl");
SystemImplementation impl = (SystemImplementation) pkg.getPublicSection().getOwnedClassifiers().get(1);
SystemInstance si = InstantiateModel.instantiate(impl);
ElementsCounts elementCounts = ComponentCounter.countComponents(si);

Assert.assertEquals(16, elementCounts.getTotalComponentCount());
Assert.assertEquals(1, elementCounts.getConnectionsCount());
Assert.assertEquals(1, elementCounts.getEndToEndFlowsCount());
Assert.assertEquals(14, elementCounts.getComponentCountMap().size());
Assert.assertEquals(2, elementCounts.getComponentCountMap().get(ComponentCategory.SYSTEM).intValue());
Assert.assertEquals(1, elementCounts.getComponentCountMap().get(ComponentCategory.ABSTRACT).intValue());
Assert.assertEquals(1, elementCounts.getComponentCountMap().get(ComponentCategory.BUS).intValue());
Assert.assertEquals(1, elementCounts.getComponentCountMap().get(ComponentCategory.DATA).intValue());
Assert.assertEquals(1, elementCounts.getComponentCountMap().get(ComponentCategory.DEVICE).intValue());
Assert.assertEquals(1, elementCounts.getComponentCountMap().get(ComponentCategory.MEMORY).intValue());
Assert.assertEquals(1, elementCounts.getComponentCountMap().get(ComponentCategory.PROCESS).intValue());
Assert.assertEquals(1, elementCounts.getComponentCountMap().get(ComponentCategory.PROCESSOR).intValue());
Assert.assertEquals(1, elementCounts.getComponentCountMap().get(ComponentCategory.SUBPROGRAM).intValue());
Assert.assertEquals(1, elementCounts.getComponentCountMap().get(ComponentCategory.SUBPROGRAM_GROUP).intValue());
Assert.assertEquals(1, elementCounts.getComponentCountMap().get(ComponentCategory.VIRTUAL_BUS).intValue());
Assert.assertEquals(1,
elementCounts.getComponentCountMap().get(ComponentCategory.VIRTUAL_PROCESSOR).intValue());
Assert.assertEquals(2, elementCounts.getComponentCountMap().get(ComponentCategory.THREAD).intValue());
}
}
7 changes: 7 additions & 0 deletions analyses/org.osate.modelstats.ui/.classpath
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="output" path="bin"/>
</classpath>
1 change: 1 addition & 0 deletions analyses/org.osate.modelstats.ui/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/bin/
68 changes: 68 additions & 0 deletions analyses/org.osate.modelstats.ui/.project
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>org.osate.modelstats.ui</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.ManifestBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.SchemaBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.oomph.version.VersionBuilder</name>
<arguments>
<dictionary>
<key>check.feature.closure.completeness</key>
<value>true</value>
</dictionary>
<dictionary>
<key>check.feature.closure.content</key>
<value>true</value>
</dictionary>
<dictionary>
<key>check.maven.pom</key>
<value>true</value>
</dictionary>
<dictionary>
<key>ignore.feature.content.redundancy</key>
<value>true</value>
</dictionary>
<dictionary>
<key>ignore.lower.bound.dependency.ranges</key>
<value>false</value>
</dictionary>
<dictionary>
<key>ignore.schema.builder</key>
<value>true</value>
</dictionary>
<dictionary>
<key>release.path</key>
<value>/releng/version-management/release.xml</value>
</dictionary>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.api.tools.apiAnalysisBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.pde.PluginNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.oomph.version.VersionNature</nature>
<nature>org.eclipse.pde.api.tools.apiAnalysisNature</nature>
</natures>
</projectDescription>
Loading