Skip to content

Commit fd4b7c4

Browse files
committed
[Fix #359] Ricardos comments
Signed-off-by: Francisco Javier Tirado Sarti <[email protected]>
1 parent e804006 commit fd4b7c4

File tree

5 files changed

+73
-23
lines changed

5 files changed

+73
-23
lines changed

api/pom.xml

+5
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,11 @@
5050
<artifactId>junit-jupiter-params</artifactId>
5151
<scope>test</scope>
5252
</dependency>
53+
<dependency>
54+
<groupId>org.assertj</groupId>
55+
<artifactId>assertj-core</artifactId>
56+
<scope>test</scope>
57+
</dependency>
5358
<dependency>
5459
<groupId>org.mockito</groupId>
5560
<artifactId>mockito-core</artifactId>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
/*
2+
* Copyright 2020-Present The Serverless Workflow Specification Authors
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
package io.serverlessworkflow.api;
17+
18+
import static io.serverlessworkflow.api.WorkflowReader.readWorkflowFromClasspath;
19+
import static org.assertj.core.api.Assertions.assertThat;
20+
21+
import io.serverlessworkflow.api.types.CallHTTP;
22+
import io.serverlessworkflow.api.types.CallTask;
23+
import io.serverlessworkflow.api.types.Task;
24+
import io.serverlessworkflow.api.types.Workflow;
25+
import java.io.IOException;
26+
import org.junit.jupiter.api.Test;
27+
28+
public class ApiTest {
29+
30+
@Test
31+
void testCallHTTPAPI() throws IOException {
32+
Workflow workflow = readWorkflowFromClasspath("features/callHttp.yaml");
33+
assertThat(workflow.getDo()).isNotEmpty();
34+
assertThat(workflow.getDo().get(0).getAdditionalProperties()).isNotEmpty();
35+
assertThat(workflow.getDo().get(0).getAdditionalProperties().values()).isNotEmpty();
36+
Task task = workflow.getDo().get(0).getAdditionalProperties().values().iterator().next();
37+
CallTask callTask = task.getCallTask();
38+
assertThat(callTask).isNotNull();
39+
assertThat(task.getDoTask()).isNull();
40+
CallHTTP httpCall = callTask.getCallHTTP();
41+
assertThat(httpCall).isNotNull();
42+
assertThat(callTask.getCallAsyncAPI()).isNull();
43+
assertThat(httpCall.getWith().getMethod()).isEqualTo("get");
44+
}
45+
}

custom-generator/pom.xml

+20-20
Original file line numberDiff line numberDiff line change
@@ -14,26 +14,26 @@
1414
</dependencies>
1515
<build>
1616
<plugins>
17-
<plugin>
18-
<groupId>com.spotify.fmt</groupId>
19-
<artifactId>fmt-maven-plugin</artifactId>
20-
<configuration>
21-
<sourceDirectory>src/main/java</sourceDirectory>
22-
<testSourceDirectory>src/test/java</testSourceDirectory>
23-
<verbose>false</verbose>
24-
<filesNamePattern>.*\.java</filesNamePattern>
25-
<skip>false</skip>
26-
<skipSortingImports>false</skipSortingImports>
27-
<style>google</style>
28-
</configuration>
29-
<executions>
30-
<execution>
31-
<goals>
32-
<goal>format</goal>
33-
</goals>
34-
</execution>
35-
</executions>
36-
</plugin>
17+
<plugin>
18+
<groupId>com.spotify.fmt</groupId>
19+
<artifactId>fmt-maven-plugin</artifactId>
20+
<configuration>
21+
<sourceDirectory>src/main/java</sourceDirectory>
22+
<testSourceDirectory>src/test/java</testSourceDirectory>
23+
<verbose>false</verbose>
24+
<filesNamePattern>.*\.java</filesNamePattern>
25+
<skip>false</skip>
26+
<skipSortingImports>false</skipSortingImports>
27+
<style>google</style>
28+
</configuration>
29+
<executions>
30+
<execution>
31+
<goals>
32+
<goal>format</goal>
33+
</goals>
34+
</execution>
35+
</executions>
36+
</plugin>
3737
</plugins>
3838
</build>
3939
</project>

custom-generator/src/main/java/io/serverlessworkflow/generator/AllAnyOneOfSchemaRule.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ private String nameFromRef(String ref, String nodeName) {
207207
if (!ref.contains("#")) {
208208
nameFromRef = Jsonschema2Pojo.getNodeName(ref, ruleFactory.getGenerationConfig());
209209
} else {
210-
String[] nameParts = split(ref, "/\\#");
210+
String[] nameParts = ref.split("[/\\#]");
211211
nameFromRef = nameParts[nameParts.length - 1];
212212
}
213213

pom.xml

+2-2
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,10 @@
5050

5151
<!-- Plugin versions, please keep in alphabetical order -->
5252
<version.buildnumber.plugin>3.2.0</version.buildnumber.plugin>
53-
<version.checkstyle.plugin>3.3.1</version.checkstyle.plugin>
53+
<version.checkstyle.plugin>3.4.0</version.checkstyle.plugin>
5454
<version.compiler.plugin>3.13.0</version.compiler.plugin>
5555
<version.deploy.plugin>3.1.2</version.deploy.plugin>
56-
<version.enforcer.plugin>3.0.0-M2</version.enforcer.plugin>
56+
<version.enforcer.plugin>3.5.0</version.enforcer.plugin>
5757
<version.failsafe.plugin>3.2.5</version.failsafe.plugin>
5858
<version.fmt-maven-plugin>2.23</version.fmt-maven-plugin>
5959
<version.gpg.plugin>3.2.4</version.gpg.plugin>

0 commit comments

Comments
 (0)