Skip to content

Commit dd87f18

Browse files
committed
[1355] Add CodingRulesTests on all modules
Bug: #1355 Signed-off-by: Axel RICHARD <axel.richard@obeo.fr>
1 parent 41f42f5 commit dd87f18

48 files changed

Lines changed: 758 additions & 45 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

CHANGELOG.adoc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,10 @@ Other versions, such as intermediate releases, are intended solely for testing p
4949
A default implementation is given with _org.eclipse.syson.sysml.helper.ImplicitSpecializationSwitch_.
5050
This new object offers a way to register immutable `LibraryPackage`.
5151
Any `Namespace` stored in those libraries are now cached for quick access.
52+
- https://github.com/eclipse-syson/syson/issues/1355[#1355] [tests] Add coding rules tests on all modules.
53+
As a consequence, some coding rules violations have been fixed.
54+
The `org.eclipse.syson.services.grammars` package in `syson-direct-edit-grammar` has been renamed into `org.eclipse.syson.direct.edit.grammars`.
55+
`AbtractItemUsageBorderNodeDescriptionProvider` has been renamed to `AbstractItemUsageBorderNodeDescriptionProvider`.
5256

5357
=== Dependency update
5458

@@ -77,6 +81,7 @@ Consumers may override this by providing an implementation of `org.eclipse.syson
7781
- https://github.com/eclipse-syson/syson/issues/1497[#1497] [database] Update the PostgreSQL version used in the docker image (used for tests purposes) to 15.
7882
- https://github.com/eclipse-syson/syson/issues/1502[#1502] [libraries] Update standard libraries to SysMLv2 2025-07 specification.
7983
- https://github.com/eclipse-syson/syson/issues/1432[#1432] [metamodel] Add implicit `Subclassification` or `Subsetting` when using semantic `MetadataUsage`.
84+
- https://github.com/eclipse-syson/syson/issues/1355[#1355] [tests] Add coding rules tests on all modules.
8085

8186
=== New features
8287

backend/application/syson-application-configuration/pom.xml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@
9191
<artifactId>syson-siriusweb-customnodes-metamodel-edit</artifactId>
9292
<version>2025.8.5</version>
9393
</dependency>
94+
<!-- Test Dependencies -->
9495
<dependency>
9596
<groupId>org.springframework.boot</groupId>
9697
<artifactId>spring-boot-starter-test</artifactId>
@@ -101,6 +102,12 @@
101102
<artifactId>junit-jupiter</artifactId>
102103
<scope>test</scope>
103104
</dependency>
105+
<dependency>
106+
<groupId>org.eclipse.syson</groupId>
107+
<artifactId>syson-tests</artifactId>
108+
<version>2025.8.5</version>
109+
<scope>test</scope>
110+
</dependency>
104111
</dependencies>
105112
<build>
106113
<plugins>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
/*******************************************************************************
2+
* Copyright (c) 2025 Obeo.
3+
* This program and the accompanying materials
4+
* are made available under the terms of the Eclipse Public License v2.0
5+
* which accompanies this distribution, and is available at
6+
* https://www.eclipse.org/legal/epl-2.0/
7+
*
8+
* SPDX-License-Identifier: EPL-2.0
9+
*
10+
* Contributors:
11+
* Obeo - initial API and implementation
12+
*******************************************************************************/
13+
package org.eclipse.syson.application.configuration;
14+
15+
import com.tngtech.archunit.core.domain.JavaClasses;
16+
import com.tngtech.archunit.core.importer.ClassFileImporter;
17+
import com.tngtech.archunit.core.importer.ImportOption;
18+
19+
/**
20+
* Constants shared across multiple tests.
21+
*
22+
* @author arichard
23+
*/
24+
public final class ArchitectureConstants {
25+
public static final String SYSON_APPLICATION_CONFIGURATION_ROOT_PACKAGE = "org.eclipse.syson.application.configuration..";
26+
27+
public static final JavaClasses CLASSES = new ClassFileImporter()
28+
.withImportOption(ImportOption.Predefined.DO_NOT_INCLUDE_JARS)
29+
.withImportOption(ImportOption.Predefined.DO_NOT_INCLUDE_TESTS)
30+
.importPackages(SYSON_APPLICATION_CONFIGURATION_ROOT_PACKAGE);
31+
32+
private ArchitectureConstants() {
33+
// Prevent instantiation
34+
}
35+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
/*******************************************************************************
2+
* Copyright (c) 2025 Obeo.
3+
* This program and the accompanying materials
4+
* are made available under the terms of the Eclipse Public License v2.0
5+
* which accompanies this distribution, and is available at
6+
* https://www.eclipse.org/legal/epl-2.0/
7+
*
8+
* SPDX-License-Identifier: EPL-2.0
9+
*
10+
* Contributors:
11+
* Obeo - initial API and implementation
12+
*******************************************************************************/
13+
package org.eclipse.syson.application.configuration;
14+
15+
import com.tngtech.archunit.core.domain.JavaClasses;
16+
17+
import org.eclipse.syson.tests.architecture.AbstractCodingRulesTests;
18+
19+
/**
20+
* Coding rules tests.
21+
*
22+
* @author arichard
23+
*/
24+
public class CodingRulesTests extends AbstractCodingRulesTests {
25+
26+
@Override
27+
protected String getProjectRootPackage() {
28+
return ArchitectureConstants.SYSON_APPLICATION_CONFIGURATION_ROOT_PACKAGE;
29+
}
30+
31+
@Override
32+
protected JavaClasses getClasses() {
33+
return ArchitectureConstants.CLASSES;
34+
}
35+
}

backend/application/syson-sysml-export/pom.xml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@
7171
<artifactId>syson-sysml-metamodel</artifactId>
7272
<version>2025.8.5</version>
7373
</dependency>
74+
<!-- Tests -->
7475
<dependency>
7576
<groupId>org.springframework.boot</groupId>
7677
<artifactId>spring-boot-starter-test</artifactId>
@@ -81,6 +82,12 @@
8182
<artifactId>junit-jupiter</artifactId>
8283
<scope>test</scope>
8384
</dependency>
85+
<dependency>
86+
<groupId>org.eclipse.syson</groupId>
87+
<artifactId>syson-tests</artifactId>
88+
<version>2025.8.5</version>
89+
<scope>test</scope>
90+
</dependency>
8491
<!-- Import test jar to access org.eclipse.syson.sysml.util -->
8592
<dependency>
8693
<groupId>org.eclipse.syson</groupId>
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
/*******************************************************************************
2+
* Copyright (c) 2025 Obeo.
3+
* This program and the accompanying materials
4+
* are made available under the terms of the Eclipse Public License v2.0
5+
* which accompanies this distribution, and is available at
6+
* https://www.eclipse.org/legal/epl-2.0/
7+
*
8+
* SPDX-License-Identifier: EPL-2.0
9+
*
10+
* Contributors:
11+
* Obeo - initial API and implementation
12+
*******************************************************************************/
13+
package org.eclipse.syson.sysml.export;
14+
15+
import com.tngtech.archunit.core.domain.JavaClasses;
16+
import com.tngtech.archunit.core.importer.ClassFileImporter;
17+
import com.tngtech.archunit.core.importer.ImportOption;
18+
19+
/**
20+
* Constants shared across multiple tests.
21+
*
22+
* @author arichard
23+
*/
24+
public final class ArchitectureConstants {
25+
public static final String SYSON_SYSML_EXPORT_ROOT_PACKAGE = "org.eclipse.syson.sysml.export..";
26+
27+
public static final JavaClasses CLASSES = new ClassFileImporter()
28+
.withImportOption(ImportOption.Predefined.DO_NOT_INCLUDE_JARS)
29+
.withImportOption(ImportOption.Predefined.DO_NOT_INCLUDE_TESTS)
30+
.importPackages(SYSON_SYSML_EXPORT_ROOT_PACKAGE);
31+
32+
private ArchitectureConstants() {
33+
// Prevent instantiation
34+
}
35+
}
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
/*******************************************************************************
2+
* Copyright (c) 2025 Obeo.
3+
* This program and the accompanying materials
4+
* are made available under the terms of the Eclipse Public License v2.0
5+
* which accompanies this distribution, and is available at
6+
* https://www.eclipse.org/legal/epl-2.0/
7+
*
8+
* SPDX-License-Identifier: EPL-2.0
9+
*
10+
* Contributors:
11+
* Obeo - initial API and implementation
12+
*******************************************************************************/
13+
package org.eclipse.syson.sysml.export;
14+
15+
import com.tngtech.archunit.core.domain.JavaClasses;
16+
17+
import org.eclipse.syson.tests.architecture.AbstractCodingRulesTests;
18+
19+
/**
20+
* Coding rules tests.
21+
*
22+
* @author arichard
23+
*/
24+
public class CodingRulesTests extends AbstractCodingRulesTests {
25+
26+
@Override
27+
protected String getProjectRootPackage() {
28+
return ArchitectureConstants.SYSON_SYSML_EXPORT_ROOT_PACKAGE;
29+
}
30+
31+
@Override
32+
protected JavaClasses getClasses() {
33+
return ArchitectureConstants.CLASSES;
34+
}
35+
}

backend/application/syson-sysml-import/pom.xml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@
7272
<artifactId>syson-services</artifactId>
7373
<version>2025.8.5</version>
7474
</dependency>
75+
<!-- Tests -->
7576
<dependency>
7677
<groupId>org.springframework.boot</groupId>
7778
<artifactId>spring-boot-starter-test</artifactId>
@@ -82,6 +83,12 @@
8283
<artifactId>junit-jupiter</artifactId>
8384
<scope>test</scope>
8485
</dependency>
86+
<dependency>
87+
<groupId>org.eclipse.syson</groupId>
88+
<artifactId>syson-tests</artifactId>
89+
<version>2025.8.5</version>
90+
<scope>test</scope>
91+
</dependency>
8592
<!--Required to be able to load standard libraries for proxy resolution toward element from the libraries in tests-->
8693
<dependency>
8794
<groupId>org.eclipse.syson</groupId>
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
/*******************************************************************************
2+
* Copyright (c) 2025 Obeo.
3+
* This program and the accompanying materials
4+
* are made available under the terms of the Eclipse Public License v2.0
5+
* which accompanies this distribution, and is available at
6+
* https://www.eclipse.org/legal/epl-2.0/
7+
*
8+
* SPDX-License-Identifier: EPL-2.0
9+
*
10+
* Contributors:
11+
* Obeo - initial API and implementation
12+
*******************************************************************************/
13+
package org.eclipse.syson.sysml;
14+
15+
import com.tngtech.archunit.core.domain.JavaClasses;
16+
import com.tngtech.archunit.core.importer.ClassFileImporter;
17+
import com.tngtech.archunit.core.importer.ImportOption;
18+
19+
/**
20+
* Constants shared across multiple tests.
21+
*
22+
* @author arichard
23+
*/
24+
public final class ArchitectureConstants {
25+
public static final String SYSON_SYSML_IMPORT_ROOT_PACKAGE = "org.eclipse.syson.sysml.import..";
26+
27+
public static final JavaClasses CLASSES = new ClassFileImporter()
28+
.withImportOption(ImportOption.Predefined.DO_NOT_INCLUDE_JARS)
29+
.withImportOption(ImportOption.Predefined.DO_NOT_INCLUDE_TESTS)
30+
.importPackages(SYSON_SYSML_IMPORT_ROOT_PACKAGE);
31+
32+
private ArchitectureConstants() {
33+
// Prevent instantiation
34+
}
35+
}
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
/*******************************************************************************
2+
* Copyright (c) 2025 Obeo.
3+
* This program and the accompanying materials
4+
* are made available under the terms of the Eclipse Public License v2.0
5+
* which accompanies this distribution, and is available at
6+
* https://www.eclipse.org/legal/epl-2.0/
7+
*
8+
* SPDX-License-Identifier: EPL-2.0
9+
*
10+
* Contributors:
11+
* Obeo - initial API and implementation
12+
*******************************************************************************/
13+
package org.eclipse.syson.sysml;
14+
15+
import com.tngtech.archunit.core.domain.JavaClasses;
16+
17+
import org.eclipse.syson.tests.architecture.AbstractCodingRulesTests;
18+
19+
/**
20+
* Coding rules tests.
21+
*
22+
* @author arichard
23+
*/
24+
public class CodingRulesTests extends AbstractCodingRulesTests {
25+
26+
@Override
27+
protected String getProjectRootPackage() {
28+
return ArchitectureConstants.SYSON_SYSML_IMPORT_ROOT_PACKAGE;
29+
}
30+
31+
@Override
32+
protected JavaClasses getClasses() {
33+
return ArchitectureConstants.CLASSES;
34+
}
35+
}

0 commit comments

Comments
 (0)