Skip to content

Commit

Permalink
execute tests during build
Browse files Browse the repository at this point in the history
  • Loading branch information
FrankHossfeld committed Sep 5, 2024
1 parent f70fad1 commit 1018649
Show file tree
Hide file tree
Showing 19 changed files with 112 additions and 261 deletions.
32 changes: 4 additions & 28 deletions nalu-plugin-core-web/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -98,44 +98,20 @@
</exclusions>
</dependency>

<!-- only for testing -->
<!-- test resources -->
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>${junit-jupiter.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-params</artifactId>
<artifactId>junit-jupiter-engine</artifactId>
<version>${junit-jupiter.version}</version>
<scope>test</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/org.junit.platform/junit-platform-runner -->
<!-- https://mvnrepository.com/artifact/org.junit.platform/junit-platform-suite-api -->
<dependency>
<groupId>org.junit.platform</groupId>
<artifactId>junit-platform-runner</artifactId>
<artifactId>junit-platform-suite-api</artifactId>
<version>${junit-jupiter-platform.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>${junit-jupiter.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
<version>${junit-jupiter.version}</version>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-core</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,8 @@
package com.github.nalukit.nalu.plugin.core.web;

import com.github.nalukit.nalu.plugin.core.web.client.NaluPluginCoreWebTest;
import org.junit.platform.runner.JUnitPlatform;
import org.junit.platform.suite.api.SelectClasses;
import org.junit.runner.RunWith;

@RunWith(JUnitPlatform.class)
@SelectClasses({ NaluPluginCoreWebTest.class })
public class AllTests {

Expand Down
7 changes: 0 additions & 7 deletions nalu-plugin-elemental2/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -113,13 +113,6 @@
</exclusion>
</exclusions>
</dependency>
<!-- gwt-events: once it is on maven central, use it!
<dependency>
<groupId>org.gwtproject.event</groupId>
<artifactId>gwt-event</artifactId>
<version>${gwt-events.version}</version>
</dependency>
-->
</dependencies>


Expand Down
7 changes: 0 additions & 7 deletions nalu-plugin-elemento/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -150,13 +150,6 @@
</exclusion>
</exclusions>
</dependency>
<!-- gwt-events: once it is on maven central, use it!
<dependency>
<groupId>org.gwtproject.event</groupId>
<artifactId>gwt-event</artifactId>
<version>${gwt-events.version}</version>
</dependency>
-->
</dependencies>


Expand Down
32 changes: 4 additions & 28 deletions nalu-plugin-gwt-processor/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -222,46 +222,22 @@
<scope>test</scope>
</dependency>

<!-- test resources -->
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>${junit-jupiter.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-params</artifactId>
<artifactId>junit-jupiter-engine</artifactId>
<version>${junit-jupiter.version}</version>
<scope>test</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/org.junit.platform/junit-platform-runner -->
<!-- https://mvnrepository.com/artifact/org.junit.platform/junit-platform-suite-api -->
<dependency>
<groupId>org.junit.platform</groupId>
<artifactId>junit-platform-runner</artifactId>
<artifactId>junit-platform-suite-api</artifactId>
<version>${junit-jupiter-platform.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>${junit-jupiter.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
<version>${junit-jupiter.version}</version>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-core</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>


<build>
<plugins>
<plugin>
Expand Down
62 changes: 18 additions & 44 deletions nalu-processor/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -170,43 +170,20 @@
<scope>test</scope>
</dependency>

<!-- test resources -->
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>${junit-jupiter.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-params</artifactId>
<artifactId>junit-jupiter-engine</artifactId>
<version>${junit-jupiter.version}</version>
<scope>test</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/org.junit.platform/junit-platform-runner -->
<!-- https://mvnrepository.com/artifact/org.junit.platform/junit-platform-suite-api -->
<dependency>
<groupId>org.junit.platform</groupId>
<artifactId>junit-platform-runner</artifactId>
<artifactId>junit-platform-suite-api</artifactId>
<version>${junit-jupiter-platform.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>${junit-jupiter.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
<version>${junit-jupiter.version}</version>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-core</artifactId>
</exclusion>
</exclusions>
</dependency>

<dependency>
<groupId>com.google.elemental2</groupId>
Expand Down Expand Up @@ -280,23 +257,20 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>${plugin.version.surfire}</version>
<executions>
<execution>
<id>unit-tests</id>
<goals>
<goal>test</goal>
</goals>
<phase>test</phase>
</execution>
</executions>
<configuration>
<includes>
<include>**/Test*.java</include>
<include>**/*Test.java</include>
<include>**/*Tests.java</include>
<include>**/*TestCase.java</include>
</includes>
</configuration>
<!-- <executions>-->
<!-- <execution>-->
<!-- <id>unit-tests</id>-->
<!-- <goals>-->
<!-- <goal>test</goal>-->
<!-- </goals>-->
<!-- <phase>test</phase>-->
<!-- </execution>-->
<!-- </executions>-->
<!-- <configuration>-->
<!-- <includes>-->
<!-- <include>**/AllTests.java</include>-->
<!-- </includes>-->
<!-- </configuration>-->
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,16 @@

public class BlockControllerModel {

private String name;
private ClassNameModel context;
private ClassNameModel controller;
private ClassNameModel componentInterface;
private ClassNameModel component;
private ClassNameModel provider;
private boolean componentCreator;
private ClassNameModel conndition;
private List<EventHandlerModel> eventHandlers;
private List<EventModel> eventModels;
private String name;
private ClassNameModel context;
private ClassNameModel controller;
private ClassNameModel componentInterface;
private ClassNameModel component;
private final ClassNameModel provider;
private boolean componentCreator;
private ClassNameModel conndition;
private List<EventHandlerModel> eventHandlers;
private List<EventModel> eventModels;

public BlockControllerModel(String name,
ClassNameModel context,
Expand Down Expand Up @@ -97,10 +97,6 @@ public ClassNameModel getProvider() {
return provider;
}

public void setProvider(ClassNameModel provider) {
this.provider = provider;
}

public boolean isComponentCreator() {
return componentCreator;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,20 +22,20 @@

public class ControllerModel {

private String[] originalRoute;
private List<String> parameters;
private ClassNameModel provider;
private final List<ParameterAcceptorModel> parameterAcceptors;
private boolean componentCreator;
private List<String> route;
private String selector;
private ClassNameModel context;
private ClassNameModel controller;
private ClassNameModel componentInterface;
private ClassNameModel component;
private List<ShellAndControllerCompositeModel> composites;
private List<EventHandlerModel> eventHandlers;
private List<EventModel> eventModels;
private String[] originalRoute;
private List<String> parameters;
private ClassNameModel provider;
private final List<ParameterAcceptorModel> parameterAcceptors;
private boolean componentCreator;
private List<String> route;
private String selector;
private ClassNameModel context;
private ClassNameModel controller;
private ClassNameModel componentInterface;
private ClassNameModel component;
private List<ShellAndControllerCompositeModel> composites;
private List<EventHandlerModel> eventHandlers;
private List<EventModel> eventModels;

public ControllerModel() {
this.parameterAcceptors = new ArrayList<>();
Expand Down Expand Up @@ -148,14 +148,6 @@ public List<ParameterAcceptorModel> getParameterAcceptors() {
return parameterAcceptors;
}

public String getParameterAcceptors(String parameterName) {
Optional<ParameterAcceptorModel> optional = this.parameterAcceptors.stream()
.filter(a -> parameterName.equals(a.getParameterName()))
.findFirst();
return optional.map(ParameterAcceptorModel::getMethodName)
.orElse(null);
}

public ParameterConstraintModel getConstraintModelFor(String parameterName) {
Optional<ParameterAcceptorModel> optional = this.parameterAcceptors.stream()
.filter(a -> parameterName.equals(a.getParameterName()))
Expand Down Expand Up @@ -237,17 +229,6 @@ private String getShellFromRoute(String route) {
return shellOfRoute;
}

private boolean matchRouteWithoutShell(String route) {
for (String originalRoute : this.originalRoute) {
String routeWithoutShell = this.getRouteWithoutShell(originalRoute);
String startRouteWithoutShell = this.getRouteWithoutShell(route);
if (routeWithoutShell.equals(startRouteWithoutShell)) {
return true;
}
}
return false;
}

public List<EventHandlerModel> getEventHandlers() {
return eventHandlers;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,12 +80,12 @@ private void validateStartRoute()
// Does the shell of the start route exist?
Optional<String> optionalShell = this.metaModel.getShells()
.stream()
.map(m -> m.getName())
.map(ShellModel::getName)
.filter(s -> s.equals(this.metaModel.getShellOfStartRoute()))
.findFirst();
if (!optionalShell.isPresent()) {
if (this.metaModel.getModules()
.size() > 0) {
if (optionalShell.isEmpty()) {
if (!this.metaModel.getModules()
.isEmpty()) {
this.processingEnvironment.getMessager()
.printMessage(Diagnostic.Kind.NOTE,
"Nalu-Processor: The shell of the startRoute >>" +
Expand All @@ -103,9 +103,9 @@ private void validateStartRoute()
.stream()
.filter(m -> m.match(this.metaModel.getStartRoute()))
.findAny();
if (!optionalRoute.isPresent()) {
if (this.metaModel.getModules()
.size() > 0) {
if (optionalRoute.isEmpty()) {
if (!this.metaModel.getModules()
.isEmpty()) {
this.processingEnvironment.getMessager()
.printMessage(Diagnostic.Kind.NOTE,
"Nalu-Processor: The route of the startRoute >>" +
Expand All @@ -131,8 +131,8 @@ private void validateStartRoute()
private void validateNoShellsDefined()
throws ProcessorException {
if (!Objects.isNull(metaModel.getApplication())) {
if (metaModel.getShells()
.size() > 0) {
if (!metaModel.getShells()
.isEmpty()) {
return;
}
throw new ProcessorException("Nalu-Processor: No shells defined! Please define (at least) one shell.");
Expand Down
Loading

0 comments on commit 1018649

Please sign in to comment.