Skip to content

Commit

Permalink
[Fix #359] Ricardos comments
Browse files Browse the repository at this point in the history
Signed-off-by: Francisco Javier Tirado Sarti <[email protected]>
  • Loading branch information
fjtirado committed Jun 26, 2024
1 parent e804006 commit fd4b7c4
Show file tree
Hide file tree
Showing 5 changed files with 73 additions and 23 deletions.
5 changes: 5 additions & 0 deletions api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,11 @@
<artifactId>junit-jupiter-params</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
Expand Down
45 changes: 45 additions & 0 deletions api/src/test/java/io/serverlessworkflow/api/ApiTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/*
* Copyright 2020-Present The Serverless Workflow Specification Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.serverlessworkflow.api;

import static io.serverlessworkflow.api.WorkflowReader.readWorkflowFromClasspath;
import static org.assertj.core.api.Assertions.assertThat;

import io.serverlessworkflow.api.types.CallHTTP;
import io.serverlessworkflow.api.types.CallTask;
import io.serverlessworkflow.api.types.Task;
import io.serverlessworkflow.api.types.Workflow;
import java.io.IOException;
import org.junit.jupiter.api.Test;

public class ApiTest {

@Test
void testCallHTTPAPI() throws IOException {
Workflow workflow = readWorkflowFromClasspath("features/callHttp.yaml");
assertThat(workflow.getDo()).isNotEmpty();
assertThat(workflow.getDo().get(0).getAdditionalProperties()).isNotEmpty();
assertThat(workflow.getDo().get(0).getAdditionalProperties().values()).isNotEmpty();
Task task = workflow.getDo().get(0).getAdditionalProperties().values().iterator().next();
CallTask callTask = task.getCallTask();
assertThat(callTask).isNotNull();
assertThat(task.getDoTask()).isNull();
CallHTTP httpCall = callTask.getCallHTTP();
assertThat(httpCall).isNotNull();
assertThat(callTask.getCallAsyncAPI()).isNull();
assertThat(httpCall.getWith().getMethod()).isEqualTo("get");
}
}
40 changes: 20 additions & 20 deletions custom-generator/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,26 +14,26 @@
</dependencies>
<build>
<plugins>
<plugin>
<groupId>com.spotify.fmt</groupId>
<artifactId>fmt-maven-plugin</artifactId>
<configuration>
<sourceDirectory>src/main/java</sourceDirectory>
<testSourceDirectory>src/test/java</testSourceDirectory>
<verbose>false</verbose>
<filesNamePattern>.*\.java</filesNamePattern>
<skip>false</skip>
<skipSortingImports>false</skipSortingImports>
<style>google</style>
</configuration>
<executions>
<execution>
<goals>
<goal>format</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>com.spotify.fmt</groupId>
<artifactId>fmt-maven-plugin</artifactId>
<configuration>
<sourceDirectory>src/main/java</sourceDirectory>
<testSourceDirectory>src/test/java</testSourceDirectory>
<verbose>false</verbose>
<filesNamePattern>.*\.java</filesNamePattern>
<skip>false</skip>
<skipSortingImports>false</skipSortingImports>
<style>google</style>
</configuration>
<executions>
<execution>
<goals>
<goal>format</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ private String nameFromRef(String ref, String nodeName) {
if (!ref.contains("#")) {
nameFromRef = Jsonschema2Pojo.getNodeName(ref, ruleFactory.getGenerationConfig());
} else {
String[] nameParts = split(ref, "/\\#");
String[] nameParts = ref.split("[/\\#]");
nameFromRef = nameParts[nameParts.length - 1];
}

Expand Down
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,10 @@

<!-- Plugin versions, please keep in alphabetical order -->
<version.buildnumber.plugin>3.2.0</version.buildnumber.plugin>
<version.checkstyle.plugin>3.3.1</version.checkstyle.plugin>
<version.checkstyle.plugin>3.4.0</version.checkstyle.plugin>
<version.compiler.plugin>3.13.0</version.compiler.plugin>
<version.deploy.plugin>3.1.2</version.deploy.plugin>
<version.enforcer.plugin>3.0.0-M2</version.enforcer.plugin>
<version.enforcer.plugin>3.5.0</version.enforcer.plugin>
<version.failsafe.plugin>3.2.5</version.failsafe.plugin>
<version.fmt-maven-plugin>2.23</version.fmt-maven-plugin>
<version.gpg.plugin>3.2.4</version.gpg.plugin>
Expand Down

0 comments on commit fd4b7c4

Please sign in to comment.