Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Windows build failure in some environments #10529

Merged
merged 13 commits into from
Oct 5, 2021
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
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,13 @@
{{{.}}}

{{/appDescription}}
{{#version}}The version of the OpenAPI document: {{{.}}}{{/version}}
{{#infoEmail}}Contact: {{{.}}}{{/infoEmail}}
{{#version}}
The version of the OpenAPI document: {{{.}}}

{{/version}}
{{#infoEmail}}
Contact: {{{.}}}

{{/infoEmail}}
Generated by OpenAPI Generator: https://openapi-generator.tech
*/
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import java.util.List;

import org.apache.commons.io.FileUtils;

import org.openapitools.codegen.DefaultGenerator;
import org.openapitools.codegen.config.CodegenConfigurator;
import org.testng.Assert;
Expand All @@ -21,6 +20,8 @@ public class MarkdownSampleGeneratorTest {

@BeforeClass
public void beforeClassGenerateTestMarkup() throws Exception {
// set line break to \n across all platforms
System.setProperty("line.separator", "\n");

this.outputTempDirectory = Files.createTempDirectory("test-markdown-sample-generator.").toFile();

Expand All @@ -44,8 +45,8 @@ public void testSampleMarkdownGeneration() throws IOException {

Assert.assertTrue(expected.exists(), "Could not find " + expected.toString());

Assert.assertEquals(FileUtils.readFileToString(generated),
FileUtils.readFileToString(expected, StandardCharsets.UTF_8));
Assert.assertEquals(FileUtils.readFileToString(generated, StandardCharsets.UTF_8).replace("\n", "").replace("\r", ""),
FileUtils.readFileToString(expected, StandardCharsets.UTF_8).replace("\n", "").replace("\r", ""));
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ public void testFeatureSet() {

@Test
public void testCodeGenWithAllOf() throws IOException {
// set line break to \n across all platforms
System.setProperty("line.separator", "\n");

File output = Files.createTempDirectory("test").toFile();

final CodegenConfigurator configurator = new CodegenConfigurator()
Expand All @@ -69,9 +72,11 @@ public void testCodeGenWithAllOf() throws IOException {
}

private void assertFileEquals(Path generatedFilePath, Path expectedFilePath) throws IOException {
String generatedFile = new String(Files.readAllBytes(generatedFilePath), StandardCharsets.UTF_8);
String expectedFile = new String(Files.readAllBytes(expectedFilePath), StandardCharsets.UTF_8);
String generatedFile = new String(Files.readAllBytes(generatedFilePath), StandardCharsets.UTF_8)
.replace("\n", "").replace("\r", "");
String expectedFile = new String(Files.readAllBytes(expectedFilePath), StandardCharsets.UTF_8)
.replace("\n", "").replace("\r", "");

assertEquals(generatedFile, expectedFile);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)

The version of the OpenAPI document: 1.0.0

Generated by OpenAPI Generator: https://openapi-generator.tech
*/

Expand Down
6 changes: 5 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -226,10 +226,14 @@
<version>${surefire-version}</version>
<configuration>
<printSummary>true</printSummary>
<forkedProcessExitTimeoutInSeconds>120</forkedProcessExitTimeoutInSeconds>
<useSystemClassLoader>false</useSystemClassLoader>
<junitArtifactName>none:none</junitArtifactName>
<testNGArtifactName>org.testng:testng</testNGArtifactName>
<argLine>@{argLine} -XX:+StartAttachListener</argLine>
<forkCount>3</forkCount>
<reuseForks>true</reuseForks>
<argLine>-Xmx1024m -XX:MaxPermSize=256m</argLine>
<systemPropertyVariables>
<org.openapitools.codegen.utils.oncelogger.expiry>1000</org.openapitools.codegen.utils.oncelogger.expiry>
<org.openapitools.codegen.utils.oncelogger.cachesize>5000</org.openapitools.codegen.utils.oncelogger.cachesize>
Expand Down Expand Up @@ -1616,7 +1620,7 @@
<jmustache-version>1.14</jmustache-version>
<handlebars.java-version>4.1.2</handlebars.java-version>
<testng-version>7.1.0</testng-version>
<surefire-version>3.0.0-M3</surefire-version>
<surefire-version>3.0.0-M5</surefire-version>
<reflections-version>0.9.10</reflections-version>
<mockito-version>3.6.28</mockito-version>
<jacoco.version>0.8.5</jacoco.version>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.

The version of the OpenAPI document: 1.0.0

Generated by OpenAPI Generator: https://openapi-generator.tech
*/

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.

The version of the OpenAPI document: 1.0.0

Generated by OpenAPI Generator: https://openapi-generator.tech
*/

Expand Down
2 changes: 1 addition & 1 deletion samples/config/petstore/protobuf-schema/models/order.proto
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.

The version of the OpenAPI document: 1.0.0

Generated by OpenAPI Generator: https://openapi-generator.tech
*/

Expand Down
2 changes: 1 addition & 1 deletion samples/config/petstore/protobuf-schema/models/pet.proto
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.

The version of the OpenAPI document: 1.0.0

Generated by OpenAPI Generator: https://openapi-generator.tech
*/

Expand Down
2 changes: 1 addition & 1 deletion samples/config/petstore/protobuf-schema/models/tag.proto
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.

The version of the OpenAPI document: 1.0.0

Generated by OpenAPI Generator: https://openapi-generator.tech
*/

Expand Down
2 changes: 1 addition & 1 deletion samples/config/petstore/protobuf-schema/models/user.proto
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.

The version of the OpenAPI document: 1.0.0

Generated by OpenAPI Generator: https://openapi-generator.tech
*/

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.

The version of the OpenAPI document: 1.0.0

Generated by OpenAPI Generator: https://openapi-generator.tech
*/

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.

The version of the OpenAPI document: 1.0.0

Generated by OpenAPI Generator: https://openapi-generator.tech
*/

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.

The version of the OpenAPI document: 1.0.0

Generated by OpenAPI Generator: https://openapi-generator.tech
*/

Expand Down