forked from loafle/openapi-generator-original
Update TestNG version (#2582)
This commit is contained in:
parent
0889b8ec13
commit
d42b6d987a
@ -21,8 +21,8 @@ import io.swagger.v3.oas.models.Components;
|
|||||||
import io.swagger.v3.oas.models.OpenAPI;
|
import io.swagger.v3.oas.models.OpenAPI;
|
||||||
import io.swagger.v3.oas.models.Operation;
|
import io.swagger.v3.oas.models.Operation;
|
||||||
import io.swagger.v3.oas.models.PathItem;
|
import io.swagger.v3.oas.models.PathItem;
|
||||||
import io.swagger.v3.oas.models.media.*;
|
|
||||||
import io.swagger.v3.oas.models.headers.Header;
|
import io.swagger.v3.oas.models.headers.Header;
|
||||||
|
import io.swagger.v3.oas.models.media.*;
|
||||||
import io.swagger.v3.oas.models.parameters.QueryParameter;
|
import io.swagger.v3.oas.models.parameters.QueryParameter;
|
||||||
import io.swagger.v3.oas.models.parameters.RequestBody;
|
import io.swagger.v3.oas.models.parameters.RequestBody;
|
||||||
import io.swagger.v3.oas.models.responses.ApiResponse;
|
import io.swagger.v3.oas.models.responses.ApiResponse;
|
||||||
|
@ -9,15 +9,13 @@ import io.swagger.v3.oas.models.media.StringSchema;
|
|||||||
import io.swagger.v3.oas.models.parameters.QueryParameter;
|
import io.swagger.v3.oas.models.parameters.QueryParameter;
|
||||||
import io.swagger.v3.oas.models.responses.ApiResponse;
|
import io.swagger.v3.oas.models.responses.ApiResponse;
|
||||||
import io.swagger.v3.oas.models.responses.ApiResponses;
|
import io.swagger.v3.oas.models.responses.ApiResponses;
|
||||||
import java.io.File;
|
|
||||||
import java.io.IOException;
|
|
||||||
import org.testng.Assert;
|
import org.testng.Assert;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.IOException;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.logging.Level;
|
|
||||||
import java.util.logging.Logger;
|
|
||||||
|
|
||||||
public class DefaultGeneratorTest {
|
public class DefaultGeneratorTest {
|
||||||
|
|
||||||
|
@ -264,7 +264,10 @@ public class AbstractJavaCodegenTest {
|
|||||||
/**
|
/**
|
||||||
* Gets artifact version.
|
* Gets artifact version.
|
||||||
* Only for testing purposes.
|
* Only for testing purposes.
|
||||||
|
* @return version
|
||||||
*/
|
*/
|
||||||
public String getArtifactVersion () { return this.artifactVersion; }
|
public String getArtifactVersion() {
|
||||||
|
return this.artifactVersion;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,6 @@ import io.swagger.v3.oas.models.parameters.RequestBody;
|
|||||||
import io.swagger.v3.oas.models.responses.ApiResponse;
|
import io.swagger.v3.oas.models.responses.ApiResponse;
|
||||||
import io.swagger.v3.oas.models.responses.ApiResponses;
|
import io.swagger.v3.oas.models.responses.ApiResponses;
|
||||||
import io.swagger.v3.parser.util.SchemaTypeUtil;
|
import io.swagger.v3.parser.util.SchemaTypeUtil;
|
||||||
import org.junit.rules.TemporaryFolder;
|
|
||||||
import org.openapitools.codegen.*;
|
import org.openapitools.codegen.*;
|
||||||
import org.openapitools.codegen.config.CodegenConfigurator;
|
import org.openapitools.codegen.config.CodegenConfigurator;
|
||||||
import org.openapitools.codegen.languages.JavaClientCodegen;
|
import org.openapitools.codegen.languages.JavaClientCodegen;
|
||||||
@ -37,10 +36,10 @@ import org.testng.annotations.DataProvider;
|
|||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
import java.nio.file.Files;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class JavaModelTest {
|
public class JavaModelTest {
|
||||||
private TemporaryFolder folder = new TemporaryFolder();
|
|
||||||
|
|
||||||
@Test(description = "convert a simple java model")
|
@Test(description = "convert a simple java model")
|
||||||
public void simpleModelTest() {
|
public void simpleModelTest() {
|
||||||
@ -1215,8 +1214,9 @@ public class JavaModelTest {
|
|||||||
public void generateModel() throws Exception {
|
public void generateModel() throws Exception {
|
||||||
String inputSpec = "src/test/resources/3_0/petstore.json";
|
String inputSpec = "src/test/resources/3_0/petstore.json";
|
||||||
|
|
||||||
folder.create();
|
final File output = Files.createTempDirectory("test").toFile();
|
||||||
final File output = folder.getRoot();
|
output.deleteOnExit();
|
||||||
|
|
||||||
Assert.assertTrue(new File(inputSpec).exists());
|
Assert.assertTrue(new File(inputSpec).exists());
|
||||||
|
|
||||||
final CodegenConfigurator configurator = new CodegenConfigurator()
|
final CodegenConfigurator configurator = new CodegenConfigurator()
|
||||||
@ -1232,15 +1232,14 @@ public class JavaModelTest {
|
|||||||
|
|
||||||
File orderFile = new File(output, "src/main/java/org/openapitools/client/model/Order.java");
|
File orderFile = new File(output, "src/main/java/org/openapitools/client/model/Order.java");
|
||||||
Assert.assertTrue(orderFile.exists());
|
Assert.assertTrue(orderFile.exists());
|
||||||
folder.delete();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void generateEmpty() throws Exception {
|
public void generateEmpty() throws Exception {
|
||||||
String inputSpec = "src/test/resources/3_0/ping.yaml";
|
String inputSpec = "src/test/resources/3_0/ping.yaml";
|
||||||
|
|
||||||
folder.create();
|
final File output = Files.createTempDirectory("test").toFile();
|
||||||
final File output = folder.getRoot();
|
output.deleteOnExit();
|
||||||
Assert.assertTrue(new File(inputSpec).exists());
|
Assert.assertTrue(new File(inputSpec).exists());
|
||||||
|
|
||||||
JavaClientCodegen config = new org.openapitools.codegen.languages.JavaClientCodegen();
|
JavaClientCodegen config = new org.openapitools.codegen.languages.JavaClientCodegen();
|
||||||
@ -1258,6 +1257,5 @@ public class JavaModelTest {
|
|||||||
|
|
||||||
File orderFile = new File(output, "src/main/java/org/openapitools/client/api/DefaultApi.java");
|
File orderFile = new File(output, "src/main/java/org/openapitools/client/api/DefaultApi.java");
|
||||||
Assert.assertTrue(orderFile.exists());
|
Assert.assertTrue(orderFile.exists());
|
||||||
folder.delete();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,17 @@
|
|||||||
package org.openapitools.codegen.java.jaxrs;
|
package org.openapitools.codegen.java.jaxrs;
|
||||||
|
|
||||||
import static org.testng.Assert.assertEquals;
|
import io.swagger.parser.OpenAPIParser;
|
||||||
import static org.testng.Assert.assertNotNull;
|
import io.swagger.v3.oas.models.OpenAPI;
|
||||||
import static org.testng.Assert.assertNull;
|
import io.swagger.v3.oas.models.servers.Server;
|
||||||
import static org.testng.Assert.assertTrue;
|
import io.swagger.v3.parser.core.models.ParseOptions;
|
||||||
|
import org.openapitools.codegen.*;
|
||||||
|
import org.openapitools.codegen.MockDefaultGenerator.WrittenTemplateBasedFile;
|
||||||
|
import org.openapitools.codegen.languages.AbstractJavaCodegen;
|
||||||
|
import org.openapitools.codegen.languages.AbstractJavaJAXRSServerCodegen;
|
||||||
|
import org.openapitools.codegen.languages.JavaCXFExtServerCodegen;
|
||||||
|
import org.openapitools.codegen.languages.features.*;
|
||||||
|
import org.testng.annotations.BeforeMethod;
|
||||||
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
@ -11,36 +19,7 @@ import java.util.List;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
import org.openapitools.codegen.ClientOptInput;
|
import static org.testng.Assert.*;
|
||||||
import org.openapitools.codegen.ClientOpts;
|
|
||||||
import org.openapitools.codegen.CodegenConstants;
|
|
||||||
import org.openapitools.codegen.CodegenOperation;
|
|
||||||
import org.openapitools.codegen.MockDefaultGenerator;
|
|
||||||
import org.openapitools.codegen.MockDefaultGenerator.WrittenTemplateBasedFile;
|
|
||||||
import org.openapitools.codegen.TestUtils;
|
|
||||||
import org.openapitools.codegen.languages.AbstractJavaCodegen;
|
|
||||||
import org.openapitools.codegen.languages.AbstractJavaJAXRSServerCodegen;
|
|
||||||
import org.openapitools.codegen.languages.JavaCXFExtServerCodegen;
|
|
||||||
import org.openapitools.codegen.languages.features.BeanValidationExtendedFeatures;
|
|
||||||
import org.openapitools.codegen.languages.features.BeanValidationFeatures;
|
|
||||||
import org.openapitools.codegen.languages.features.CXFExtServerFeatures;
|
|
||||||
import org.openapitools.codegen.languages.features.CXFServerFeatures;
|
|
||||||
import org.openapitools.codegen.languages.features.GzipFeatures;
|
|
||||||
import org.openapitools.codegen.languages.features.GzipTestFeatures;
|
|
||||||
import org.openapitools.codegen.languages.features.JbossFeature;
|
|
||||||
import org.openapitools.codegen.languages.features.LoggingFeatures;
|
|
||||||
import org.openapitools.codegen.languages.features.LoggingTestFeatures;
|
|
||||||
import org.openapitools.codegen.languages.features.SpringFeatures;
|
|
||||||
import org.openapitools.codegen.languages.features.SwaggerFeatures;
|
|
||||||
import org.openapitools.codegen.languages.features.SwaggerUIFeatures;
|
|
||||||
import org.openapitools.codegen.languages.features.UseGenericResponseFeatures;
|
|
||||||
import org.testng.annotations.BeforeMethod;
|
|
||||||
import org.testng.annotations.Test;
|
|
||||||
|
|
||||||
import io.swagger.parser.OpenAPIParser;
|
|
||||||
import io.swagger.v3.oas.models.OpenAPI;
|
|
||||||
import io.swagger.v3.oas.models.servers.Server;
|
|
||||||
import io.swagger.v3.parser.core.models.ParseOptions;
|
|
||||||
|
|
||||||
public class JavaJAXRSCXFExtServerCodegenTest {
|
public class JavaJAXRSCXFExtServerCodegenTest {
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
|
@ -1,18 +1,16 @@
|
|||||||
package org.openapitools.codegen.java.jaxrs;
|
package org.openapitools.codegen.java.jaxrs;
|
||||||
|
|
||||||
import io.swagger.v3.oas.models.Operation;
|
import io.swagger.v3.oas.models.Operation;
|
||||||
import org.junit.Before;
|
|
||||||
import org.junit.Test;
|
|
||||||
import org.openapitools.codegen.CodegenOperation;
|
import org.openapitools.codegen.CodegenOperation;
|
||||||
import org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen;
|
import org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen;
|
||||||
|
import org.testng.Assert;
|
||||||
|
import org.testng.annotations.BeforeMethod;
|
||||||
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import static org.hamcrest.CoreMatchers.is;
|
|
||||||
import static org.junit.Assert.assertThat;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Unit-Test for {@link org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen}.
|
* Unit-Test for {@link org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen}.
|
||||||
*
|
*
|
||||||
@ -22,7 +20,7 @@ public class JavaJAXRSSpecServerCodegenTest {
|
|||||||
|
|
||||||
private JavaJAXRSSpecServerCodegen instance;
|
private JavaJAXRSSpecServerCodegen instance;
|
||||||
|
|
||||||
@Before
|
@BeforeMethod
|
||||||
public void before() {
|
public void before() {
|
||||||
instance = new JavaJAXRSSpecServerCodegen();
|
instance = new JavaJAXRSSpecServerCodegen();
|
||||||
}
|
}
|
||||||
@ -40,9 +38,9 @@ public class JavaJAXRSSpecServerCodegenTest {
|
|||||||
|
|
||||||
instance.addOperationToGroup("Primaryresource", "/", operation, codegenOperation, operationList);
|
instance.addOperationToGroup("Primaryresource", "/", operation, codegenOperation, operationList);
|
||||||
|
|
||||||
assertThat(operationList.size(), is(1));
|
Assert.assertEquals(operationList.size(), 1);
|
||||||
assertThat(operationList.containsKey(""), is(true));
|
Assert.assertTrue(operationList.containsKey(""));
|
||||||
assertThat(codegenOperation.baseName, is("Primaryresource"));
|
Assert.assertEquals(codegenOperation.baseName, "Primaryresource");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -58,9 +56,9 @@ public class JavaJAXRSSpecServerCodegenTest {
|
|||||||
|
|
||||||
instance.addOperationToGroup("Primaryresource", "/{uuid}", operation, codegenOperation, operationList);
|
instance.addOperationToGroup("Primaryresource", "/{uuid}", operation, codegenOperation, operationList);
|
||||||
|
|
||||||
assertThat(operationList.size(), is(1));
|
Assert.assertEquals(operationList.size(), 1);
|
||||||
assertThat(operationList.containsKey(""), is(true));
|
Assert.assertTrue(operationList.containsKey(""));
|
||||||
assertThat(codegenOperation.baseName, is("Primaryresource"));
|
Assert.assertEquals(codegenOperation.baseName, "Primaryresource");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -77,9 +75,9 @@ public class JavaJAXRSSpecServerCodegenTest {
|
|||||||
|
|
||||||
instance.addOperationToGroup("Default", "/subresource", operation, codegenOperation, operationList);
|
instance.addOperationToGroup("Default", "/subresource", operation, codegenOperation, operationList);
|
||||||
|
|
||||||
assertThat(codegenOperation.baseName, is("subresource"));
|
Assert.assertEquals(codegenOperation.baseName, "subresource");
|
||||||
assertThat(operationList.size(), is(1));
|
Assert.assertEquals(operationList.size(), 1);
|
||||||
assertThat(operationList.containsKey("subresource"), is(true));
|
Assert.assertTrue(operationList.containsKey("subresource"));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -88,7 +86,7 @@ public class JavaJAXRSSpecServerCodegenTest {
|
|||||||
@Test
|
@Test
|
||||||
public void testToApiNameForSubresource() {
|
public void testToApiNameForSubresource() {
|
||||||
final String subresource = instance.toApiName("subresource");
|
final String subresource = instance.toApiName("subresource");
|
||||||
assertThat(subresource, is("SubresourceApi"));
|
Assert.assertEquals(subresource, "SubresourceApi");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -103,6 +101,6 @@ public class JavaJAXRSSpecServerCodegenTest {
|
|||||||
instance.addOperationToGroup("Primaryresource", "/", operation, codegenOperation, operationList);
|
instance.addOperationToGroup("Primaryresource", "/", operation, codegenOperation, operationList);
|
||||||
|
|
||||||
final String subresource = instance.toApiName("");
|
final String subresource = instance.toApiName("");
|
||||||
assertThat(subresource, is("PrimaryresourceApi"));
|
Assert.assertEquals(subresource, "PrimaryresourceApi");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -21,16 +21,14 @@ import io.swagger.v3.oas.models.OpenAPI;
|
|||||||
import io.swagger.v3.oas.models.Operation;
|
import io.swagger.v3.oas.models.Operation;
|
||||||
import io.swagger.v3.oas.models.media.Schema;
|
import io.swagger.v3.oas.models.media.Schema;
|
||||||
import org.apache.commons.io.FileUtils;
|
import org.apache.commons.io.FileUtils;
|
||||||
import org.junit.rules.TemporaryFolder;
|
|
||||||
import org.openapitools.codegen.*;
|
import org.openapitools.codegen.*;
|
||||||
import org.openapitools.codegen.languages.RubyClientCodegen;
|
import org.openapitools.codegen.languages.RubyClientCodegen;
|
||||||
import org.testng.Assert;
|
import org.testng.Assert;
|
||||||
import org.testng.annotations.AfterMethod;
|
|
||||||
import org.testng.annotations.BeforeMethod;
|
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
|
import java.nio.file.Files;
|
||||||
import java.util.LinkedHashSet;
|
import java.util.LinkedHashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
@ -44,21 +42,12 @@ import static org.testng.Assert.fail;
|
|||||||
*/
|
*/
|
||||||
public class RubyClientCodegenTest {
|
public class RubyClientCodegenTest {
|
||||||
|
|
||||||
public TemporaryFolder folder = new TemporaryFolder();
|
|
||||||
|
|
||||||
@BeforeMethod
|
|
||||||
public void setUp() throws Exception {
|
|
||||||
folder.create();
|
|
||||||
}
|
|
||||||
|
|
||||||
@AfterMethod
|
|
||||||
public void tearDown() throws Exception {
|
|
||||||
folder.delete();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testGenerateRubyClientWithHtmlEntity() throws Exception {
|
public void testGenerateRubyClientWithHtmlEntity() throws Exception {
|
||||||
final File output = folder.getRoot();
|
final File output = Files.createTempDirectory("test").toFile();
|
||||||
|
output.mkdirs();
|
||||||
|
output.deleteOnExit();
|
||||||
|
|
||||||
final OpenAPI openAPI = TestUtils.parseSpec("src/test/resources/2_0/pathWithHtmlEntity.yaml");
|
final OpenAPI openAPI = TestUtils.parseSpec("src/test/resources/2_0/pathWithHtmlEntity.yaml");
|
||||||
CodegenConfig codegenConfig = new RubyClientCodegen();
|
CodegenConfig codegenConfig = new RubyClientCodegen();
|
||||||
@ -120,7 +109,9 @@ public class RubyClientCodegenTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testBooleanDefaultValue() throws Exception {
|
public void testBooleanDefaultValue() throws Exception {
|
||||||
final File output = folder.getRoot();
|
final File output = Files.createTempDirectory("test").toFile();
|
||||||
|
output.mkdirs();
|
||||||
|
output.deleteOnExit();
|
||||||
|
|
||||||
final OpenAPI openAPI = TestUtils.parseSpec("src/test/resources/2_0/npe1.yaml");
|
final OpenAPI openAPI = TestUtils.parseSpec("src/test/resources/2_0/npe1.yaml");
|
||||||
CodegenConfig codegenConfig = new RubyClientCodegen();
|
CodegenConfig codegenConfig = new RubyClientCodegen();
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
package org.openapitools.codegen.typescript.fetch;
|
package org.openapitools.codegen.typescript.fetch;
|
||||||
|
|
||||||
import org.junit.Assert;
|
|
||||||
import org.junit.Test;
|
|
||||||
import org.openapitools.codegen.languages.TypeScriptFetchClientCodegen;
|
import org.openapitools.codegen.languages.TypeScriptFetchClientCodegen;
|
||||||
|
import org.testng.Assert;
|
||||||
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
|
|
||||||
public class TypeScriptFetchClientCodegenTest {
|
public class TypeScriptFetchClientCodegenTest {
|
||||||
|
@ -1,15 +1,15 @@
|
|||||||
package org.openapitools.codegen.typescript.typescriptangular;
|
package org.openapitools.codegen.typescript.typescriptangular;
|
||||||
|
|
||||||
import org.junit.Assert;
|
|
||||||
import org.junit.Test;
|
|
||||||
import org.openapitools.codegen.languages.TypeScriptAngularClientCodegen;
|
|
||||||
import org.openapitools.codegen.TestUtils;
|
|
||||||
import io.swagger.v3.oas.models.OpenAPI;
|
import io.swagger.v3.oas.models.OpenAPI;
|
||||||
import io.swagger.v3.oas.models.Operation;
|
import io.swagger.v3.oas.models.Operation;
|
||||||
import org.openapitools.codegen.CodegenOperation;
|
|
||||||
import io.swagger.v3.oas.models.PathItem;
|
import io.swagger.v3.oas.models.PathItem;
|
||||||
import io.swagger.v3.oas.models.responses.ApiResponse;
|
import io.swagger.v3.oas.models.responses.ApiResponse;
|
||||||
import io.swagger.v3.oas.models.responses.ApiResponses;
|
import io.swagger.v3.oas.models.responses.ApiResponses;
|
||||||
|
import org.openapitools.codegen.CodegenOperation;
|
||||||
|
import org.openapitools.codegen.TestUtils;
|
||||||
|
import org.openapitools.codegen.languages.TypeScriptAngularClientCodegen;
|
||||||
|
import org.testng.Assert;
|
||||||
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
|
|
||||||
public class TypeScriptAngularClientCodegenTest {
|
public class TypeScriptAngularClientCodegenTest {
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
package org.openapitools.codegen.typescript.typescriptangular;
|
package org.openapitools.codegen.typescript.typescriptangular;
|
||||||
|
|
||||||
import io.swagger.v3.oas.models.OpenAPI;
|
import io.swagger.v3.oas.models.OpenAPI;
|
||||||
import org.junit.Assert;
|
|
||||||
import org.junit.Test;
|
|
||||||
import org.openapitools.codegen.TestUtils;
|
import org.openapitools.codegen.TestUtils;
|
||||||
import org.openapitools.codegen.languages.TypeScriptAngularClientCodegen;
|
import org.openapitools.codegen.languages.TypeScriptAngularClientCodegen;
|
||||||
|
import org.testng.Assert;
|
||||||
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
public class TypescriptAngularApiVersionTest {
|
public class TypescriptAngularApiVersionTest {
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@ public class TypeScriptNodeClientCodegenTest {
|
|||||||
codegen.additionalProperties().put("npmVersion", "1.0.0-SNAPSHOT");
|
codegen.additionalProperties().put("npmVersion", "1.0.0-SNAPSHOT");
|
||||||
codegen.processOpts();
|
codegen.processOpts();
|
||||||
|
|
||||||
org.junit.Assert.assertTrue(codegen.getNpmVersion().matches("^1.0.0-SNAPSHOT.[0-9]{12}$"));
|
Assert.assertTrue(codegen.getNpmVersion().matches("^1.0.0-SNAPSHOT.[0-9]{12}$"));
|
||||||
|
|
||||||
codegen = new TypeScriptNodeClientCodegen();
|
codegen = new TypeScriptNodeClientCodegen();
|
||||||
codegen.additionalProperties().put("npmName", "@openapi/typescript-angular-petstore");
|
codegen.additionalProperties().put("npmName", "@openapi/typescript-angular-petstore");
|
||||||
@ -34,7 +34,7 @@ public class TypeScriptNodeClientCodegenTest {
|
|||||||
codegen.additionalProperties().put("npmVersion", "3.0.0-M1");
|
codegen.additionalProperties().put("npmVersion", "3.0.0-M1");
|
||||||
codegen.processOpts();
|
codegen.processOpts();
|
||||||
|
|
||||||
org.junit.Assert.assertTrue(codegen.getNpmVersion().matches("^3.0.0-M1-SNAPSHOT.[0-9]{12}$"));
|
Assert.assertTrue(codegen.getNpmVersion().matches("^3.0.0-M1-SNAPSHOT.[0-9]{12}$"));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -46,7 +46,7 @@ public class TypeScriptNodeClientCodegenTest {
|
|||||||
codegen.additionalProperties().put("npmVersion", "1.0.0-SNAPSHOT");
|
codegen.additionalProperties().put("npmVersion", "1.0.0-SNAPSHOT");
|
||||||
codegen.processOpts();
|
codegen.processOpts();
|
||||||
|
|
||||||
org.junit.Assert.assertTrue(codegen.getNpmVersion().matches("^1.0.0-SNAPSHOT$"));
|
Assert.assertTrue(codegen.getNpmVersion().matches("^1.0.0-SNAPSHOT$"));
|
||||||
|
|
||||||
codegen = new TypeScriptNodeClientCodegen();
|
codegen = new TypeScriptNodeClientCodegen();
|
||||||
codegen.additionalProperties().put("npmName", "@openapi/typescript-angular-petstore");
|
codegen.additionalProperties().put("npmName", "@openapi/typescript-angular-petstore");
|
||||||
@ -54,7 +54,7 @@ public class TypeScriptNodeClientCodegenTest {
|
|||||||
codegen.additionalProperties().put("npmVersion", "3.0.0-M1");
|
codegen.additionalProperties().put("npmVersion", "3.0.0-M1");
|
||||||
codegen.processOpts();
|
codegen.processOpts();
|
||||||
|
|
||||||
org.junit.Assert.assertTrue(codegen.getNpmVersion().matches("^3.0.0-M1$"));
|
Assert.assertTrue(codegen.getNpmVersion().matches("^3.0.0-M1$"));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -3,9 +3,7 @@ package org.openapitools.codegen.utils;
|
|||||||
import org.testng.Assert;
|
import org.testng.Assert;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
import static org.openapitools.codegen.utils.StringUtils.camelize;
|
import static org.openapitools.codegen.utils.StringUtils.*;
|
||||||
import static org.openapitools.codegen.utils.StringUtils.dashize;
|
|
||||||
import static org.openapitools.codegen.utils.StringUtils.underscore;
|
|
||||||
|
|
||||||
public class StringUtilsTest {
|
public class StringUtilsTest {
|
||||||
// we'll assume that <i>underscore</i> (Twitter elephant bird) works fine
|
// we'll assume that <i>underscore</i> (Twitter elephant bird) works fine
|
||||||
|
20
pom.xml
20
pom.xml
@ -157,23 +157,11 @@
|
|||||||
<version>${surefire-version}</version>
|
<version>${surefire-version}</version>
|
||||||
<configuration>
|
<configuration>
|
||||||
<useSystemClassLoader>false</useSystemClassLoader>
|
<useSystemClassLoader>false</useSystemClassLoader>
|
||||||
<testNGArtifactName>none:none</testNGArtifactName>
|
<junitArtifactName>none:none</junitArtifactName>
|
||||||
|
<testNGArtifactName>org.testng:testng</testNGArtifactName>
|
||||||
<argLine>-XX:+StartAttachListener</argLine>
|
<argLine>-XX:+StartAttachListener</argLine>
|
||||||
<argLine>-javaagent:"${settings.localRepository}/org/jmockit/jmockit/${jmockit-version}/jmockit-${jmockit-version}.jar"</argLine>
|
<argLine>-javaagent:"${settings.localRepository}/org/jmockit/jmockit/${jmockit-version}/jmockit-${jmockit-version}.jar"</argLine>
|
||||||
</configuration>
|
</configuration>
|
||||||
<executions>
|
|
||||||
<execution>
|
|
||||||
<id>test-testng</id>
|
|
||||||
<phase>test</phase>
|
|
||||||
<goals>
|
|
||||||
<goal>test</goal>
|
|
||||||
</goals>
|
|
||||||
<configuration>
|
|
||||||
<junitArtifactName>none:none</junitArtifactName>
|
|
||||||
<testNGArtifactName>org.testng:testng</testNGArtifactName>
|
|
||||||
</configuration>
|
|
||||||
</execution>
|
|
||||||
</executions>
|
|
||||||
</plugin>
|
</plugin>
|
||||||
<plugin>
|
<plugin>
|
||||||
<artifactId>maven-dependency-plugin</artifactId>
|
<artifactId>maven-dependency-plugin</artifactId>
|
||||||
@ -1383,8 +1371,8 @@
|
|||||||
<slf4j-version>1.7.12</slf4j-version>
|
<slf4j-version>1.7.12</slf4j-version>
|
||||||
<scala-maven-plugin-version>3.2.1</scala-maven-plugin-version>
|
<scala-maven-plugin-version>3.2.1</scala-maven-plugin-version>
|
||||||
<jmustache-version>1.14</jmustache-version>
|
<jmustache-version>1.14</jmustache-version>
|
||||||
<testng-version>6.9.6</testng-version>
|
<testng-version>6.14.3</testng-version>
|
||||||
<surefire-version>2.22.0</surefire-version>
|
<surefire-version>2.22.1</surefire-version>
|
||||||
<jmockit-version>1.43</jmockit-version>
|
<jmockit-version>1.43</jmockit-version>
|
||||||
<reflections-version>0.9.10</reflections-version>
|
<reflections-version>0.9.10</reflections-version>
|
||||||
</properties>
|
</properties>
|
||||||
|
@ -120,7 +120,8 @@ paths:
|
|||||||
/pet/findByTags:
|
/pet/findByTags:
|
||||||
get:
|
get:
|
||||||
deprecated: true
|
deprecated: true
|
||||||
description: Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
|
description: Multiple tags can be provided with comma separated strings. Use
|
||||||
|
tag1, tag2, tag3 for testing.
|
||||||
operationId: findPetsByTags
|
operationId: findPetsByTags
|
||||||
parameters:
|
parameters:
|
||||||
- description: Tags to filter by
|
- description: Tags to filter by
|
||||||
@ -332,7 +333,8 @@ paths:
|
|||||||
x-codegen-request-body-name: body
|
x-codegen-request-body-name: body
|
||||||
/store/order/{order_id}:
|
/store/order/{order_id}:
|
||||||
delete:
|
delete:
|
||||||
description: For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
|
description: For valid response try integer IDs with value < 1000. Anything
|
||||||
|
above 1000 or nonintegers will generate API errors
|
||||||
operationId: deleteOrder
|
operationId: deleteOrder
|
||||||
parameters:
|
parameters:
|
||||||
- description: ID of the order that needs to be deleted
|
- description: ID of the order that needs to be deleted
|
||||||
@ -352,7 +354,8 @@ paths:
|
|||||||
tags:
|
tags:
|
||||||
- store
|
- store
|
||||||
get:
|
get:
|
||||||
description: For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions
|
description: For valid response try integer IDs with value <= 5 or > 10. Other
|
||||||
|
values will generated exceptions
|
||||||
operationId: getOrderById
|
operationId: getOrderById
|
||||||
parameters:
|
parameters:
|
||||||
- description: ID of pet that needs to be fetched
|
- description: ID of pet that needs to be fetched
|
||||||
@ -1072,7 +1075,8 @@ paths:
|
|||||||
x-codegen-request-body-name: body
|
x-codegen-request-body-name: body
|
||||||
/fake/body-with-file-schema:
|
/fake/body-with-file-schema:
|
||||||
put:
|
put:
|
||||||
description: For this test, the body for this request much reference a schema named `File`.
|
description: For this test, the body for this request much reference a schema
|
||||||
|
named `File`.
|
||||||
operationId: testBodyWithFileSchema
|
operationId: testBodyWithFileSchema
|
||||||
requestBody:
|
requestBody:
|
||||||
content:
|
content:
|
||||||
|
@ -120,7 +120,8 @@ paths:
|
|||||||
/pet/findByTags:
|
/pet/findByTags:
|
||||||
get:
|
get:
|
||||||
deprecated: true
|
deprecated: true
|
||||||
description: Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
|
description: Multiple tags can be provided with comma separated strings. Use
|
||||||
|
tag1, tag2, tag3 for testing.
|
||||||
operationId: findPetsByTags
|
operationId: findPetsByTags
|
||||||
parameters:
|
parameters:
|
||||||
- description: Tags to filter by
|
- description: Tags to filter by
|
||||||
@ -332,7 +333,8 @@ paths:
|
|||||||
x-codegen-request-body-name: body
|
x-codegen-request-body-name: body
|
||||||
/store/order/{order_id}:
|
/store/order/{order_id}:
|
||||||
delete:
|
delete:
|
||||||
description: For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
|
description: For valid response try integer IDs with value < 1000. Anything
|
||||||
|
above 1000 or nonintegers will generate API errors
|
||||||
operationId: deleteOrder
|
operationId: deleteOrder
|
||||||
parameters:
|
parameters:
|
||||||
- description: ID of the order that needs to be deleted
|
- description: ID of the order that needs to be deleted
|
||||||
@ -352,7 +354,8 @@ paths:
|
|||||||
tags:
|
tags:
|
||||||
- store
|
- store
|
||||||
get:
|
get:
|
||||||
description: For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions
|
description: For valid response try integer IDs with value <= 5 or > 10. Other
|
||||||
|
values will generated exceptions
|
||||||
operationId: getOrderById
|
operationId: getOrderById
|
||||||
parameters:
|
parameters:
|
||||||
- description: ID of pet that needs to be fetched
|
- description: ID of pet that needs to be fetched
|
||||||
@ -1072,7 +1075,8 @@ paths:
|
|||||||
x-codegen-request-body-name: body
|
x-codegen-request-body-name: body
|
||||||
/fake/body-with-file-schema:
|
/fake/body-with-file-schema:
|
||||||
put:
|
put:
|
||||||
description: For this test, the body for this request much reference a schema named `File`.
|
description: For this test, the body for this request much reference a schema
|
||||||
|
named `File`.
|
||||||
operationId: testBodyWithFileSchema
|
operationId: testBodyWithFileSchema
|
||||||
requestBody:
|
requestBody:
|
||||||
content:
|
content:
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
openapi: 3.0.1
|
openapi: 3.0.1
|
||||||
info:
|
info:
|
||||||
description: This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
|
description: This is a sample server Petstore server. For this sample, you can use
|
||||||
|
the api key `special-key` to test the authorization filters.
|
||||||
license:
|
license:
|
||||||
name: Apache-2.0
|
name: Apache-2.0
|
||||||
url: http://www.apache.org/licenses/LICENSE-2.0.html
|
url: http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
@ -118,7 +119,8 @@ paths:
|
|||||||
/pet/findByTags:
|
/pet/findByTags:
|
||||||
get:
|
get:
|
||||||
deprecated: true
|
deprecated: true
|
||||||
description: Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
|
description: Multiple tags can be provided with comma separated strings. Use
|
||||||
|
tag1, tag2, tag3 for testing.
|
||||||
operationId: findPetsByTags
|
operationId: findPetsByTags
|
||||||
parameters:
|
parameters:
|
||||||
- description: Tags to filter by
|
- description: Tags to filter by
|
||||||
@ -330,7 +332,8 @@ paths:
|
|||||||
x-codegen-request-body-name: body
|
x-codegen-request-body-name: body
|
||||||
/store/order/{orderId}:
|
/store/order/{orderId}:
|
||||||
delete:
|
delete:
|
||||||
description: For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
|
description: For valid response try integer IDs with value < 1000. Anything
|
||||||
|
above 1000 or nonintegers will generate API errors
|
||||||
operationId: deleteOrder
|
operationId: deleteOrder
|
||||||
parameters:
|
parameters:
|
||||||
- description: ID of the order that needs to be deleted
|
- description: ID of the order that needs to be deleted
|
||||||
@ -350,7 +353,8 @@ paths:
|
|||||||
tags:
|
tags:
|
||||||
- store
|
- store
|
||||||
get:
|
get:
|
||||||
description: For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions
|
description: For valid response try integer IDs with value <= 5 or > 10. Other
|
||||||
|
values will generated exceptions
|
||||||
operationId: getOrderById
|
operationId: getOrderById
|
||||||
parameters:
|
parameters:
|
||||||
- description: ID of pet that needs to be fetched
|
- description: ID of pet that needs to be fetched
|
||||||
|
@ -126,7 +126,8 @@ paths:
|
|||||||
/pet/findByTags:
|
/pet/findByTags:
|
||||||
get:
|
get:
|
||||||
deprecated: true
|
deprecated: true
|
||||||
description: Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
|
description: Multiple tags can be provided with comma separated strings. Use
|
||||||
|
tag1, tag2, tag3 for testing.
|
||||||
operationId: findPetsByTags
|
operationId: findPetsByTags
|
||||||
parameters:
|
parameters:
|
||||||
- description: Tags to filter by
|
- description: Tags to filter by
|
||||||
@ -352,7 +353,8 @@ paths:
|
|||||||
- tag: store
|
- tag: store
|
||||||
/store/order/{order_id}:
|
/store/order/{order_id}:
|
||||||
delete:
|
delete:
|
||||||
description: For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
|
description: For valid response try integer IDs with value < 1000. Anything
|
||||||
|
above 1000 or nonintegers will generate API errors
|
||||||
operationId: deleteOrder
|
operationId: deleteOrder
|
||||||
parameters:
|
parameters:
|
||||||
- description: ID of the order that needs to be deleted
|
- description: ID of the order that needs to be deleted
|
||||||
@ -374,7 +376,8 @@ paths:
|
|||||||
x-tags:
|
x-tags:
|
||||||
- tag: store
|
- tag: store
|
||||||
get:
|
get:
|
||||||
description: For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions
|
description: For valid response try integer IDs with value <= 5 or > 10. Other
|
||||||
|
values will generated exceptions
|
||||||
operationId: getOrderById
|
operationId: getOrderById
|
||||||
parameters:
|
parameters:
|
||||||
- description: ID of pet that needs to be fetched
|
- description: ID of pet that needs to be fetched
|
||||||
@ -1140,7 +1143,8 @@ paths:
|
|||||||
- tag: $another-fake?
|
- tag: $another-fake?
|
||||||
/fake/body-with-file-schema:
|
/fake/body-with-file-schema:
|
||||||
put:
|
put:
|
||||||
description: For this test, the body for this request much reference a schema named `File`.
|
description: For this test, the body for this request much reference a schema
|
||||||
|
named `File`.
|
||||||
operationId: testBodyWithFileSchema
|
operationId: testBodyWithFileSchema
|
||||||
requestBody:
|
requestBody:
|
||||||
content:
|
content:
|
||||||
|
@ -126,7 +126,8 @@ paths:
|
|||||||
/pet/findByTags:
|
/pet/findByTags:
|
||||||
get:
|
get:
|
||||||
deprecated: true
|
deprecated: true
|
||||||
description: Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
|
description: Multiple tags can be provided with comma separated strings. Use
|
||||||
|
tag1, tag2, tag3 for testing.
|
||||||
operationId: findPetsByTags
|
operationId: findPetsByTags
|
||||||
parameters:
|
parameters:
|
||||||
- description: Tags to filter by
|
- description: Tags to filter by
|
||||||
@ -352,7 +353,8 @@ paths:
|
|||||||
- tag: store
|
- tag: store
|
||||||
/store/order/{order_id}:
|
/store/order/{order_id}:
|
||||||
delete:
|
delete:
|
||||||
description: For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
|
description: For valid response try integer IDs with value < 1000. Anything
|
||||||
|
above 1000 or nonintegers will generate API errors
|
||||||
operationId: deleteOrder
|
operationId: deleteOrder
|
||||||
parameters:
|
parameters:
|
||||||
- description: ID of the order that needs to be deleted
|
- description: ID of the order that needs to be deleted
|
||||||
@ -374,7 +376,8 @@ paths:
|
|||||||
x-tags:
|
x-tags:
|
||||||
- tag: store
|
- tag: store
|
||||||
get:
|
get:
|
||||||
description: For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions
|
description: For valid response try integer IDs with value <= 5 or > 10. Other
|
||||||
|
values will generated exceptions
|
||||||
operationId: getOrderById
|
operationId: getOrderById
|
||||||
parameters:
|
parameters:
|
||||||
- description: ID of pet that needs to be fetched
|
- description: ID of pet that needs to be fetched
|
||||||
@ -1140,7 +1143,8 @@ paths:
|
|||||||
- tag: $another-fake?
|
- tag: $another-fake?
|
||||||
/fake/body-with-file-schema:
|
/fake/body-with-file-schema:
|
||||||
put:
|
put:
|
||||||
description: For this test, the body for this request much reference a schema named `File`.
|
description: For this test, the body for this request much reference a schema
|
||||||
|
named `File`.
|
||||||
operationId: testBodyWithFileSchema
|
operationId: testBodyWithFileSchema
|
||||||
requestBody:
|
requestBody:
|
||||||
content:
|
content:
|
||||||
|
@ -120,7 +120,8 @@ paths:
|
|||||||
/pet/findByTags:
|
/pet/findByTags:
|
||||||
get:
|
get:
|
||||||
deprecated: true
|
deprecated: true
|
||||||
description: Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
|
description: Multiple tags can be provided with comma separated strings. Use
|
||||||
|
tag1, tag2, tag3 for testing.
|
||||||
operationId: findPetsByTags
|
operationId: findPetsByTags
|
||||||
parameters:
|
parameters:
|
||||||
- description: Tags to filter by
|
- description: Tags to filter by
|
||||||
@ -332,7 +333,8 @@ paths:
|
|||||||
x-codegen-request-body-name: body
|
x-codegen-request-body-name: body
|
||||||
/store/order/{order_id}:
|
/store/order/{order_id}:
|
||||||
delete:
|
delete:
|
||||||
description: For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
|
description: For valid response try integer IDs with value < 1000. Anything
|
||||||
|
above 1000 or nonintegers will generate API errors
|
||||||
operationId: deleteOrder
|
operationId: deleteOrder
|
||||||
parameters:
|
parameters:
|
||||||
- description: ID of the order that needs to be deleted
|
- description: ID of the order that needs to be deleted
|
||||||
@ -352,7 +354,8 @@ paths:
|
|||||||
tags:
|
tags:
|
||||||
- store
|
- store
|
||||||
get:
|
get:
|
||||||
description: For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions
|
description: For valid response try integer IDs with value <= 5 or > 10. Other
|
||||||
|
values will generated exceptions
|
||||||
operationId: getOrderById
|
operationId: getOrderById
|
||||||
parameters:
|
parameters:
|
||||||
- description: ID of pet that needs to be fetched
|
- description: ID of pet that needs to be fetched
|
||||||
|
@ -131,7 +131,8 @@ paths:
|
|||||||
/pet/findByTags:
|
/pet/findByTags:
|
||||||
get:
|
get:
|
||||||
deprecated: true
|
deprecated: true
|
||||||
description: Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
|
description: Multiple tags can be provided with comma separated strings. Use
|
||||||
|
tag1, tag2, tag3 for testing.
|
||||||
operationId: findPetsByTags
|
operationId: findPetsByTags
|
||||||
parameters:
|
parameters:
|
||||||
- description: Tags to filter by
|
- description: Tags to filter by
|
||||||
@ -367,7 +368,8 @@ paths:
|
|||||||
- tag: store
|
- tag: store
|
||||||
/store/order/{order_id}:
|
/store/order/{order_id}:
|
||||||
delete:
|
delete:
|
||||||
description: For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
|
description: For valid response try integer IDs with value < 1000. Anything
|
||||||
|
above 1000 or nonintegers will generate API errors
|
||||||
operationId: deleteOrder
|
operationId: deleteOrder
|
||||||
parameters:
|
parameters:
|
||||||
- description: ID of the order that needs to be deleted
|
- description: ID of the order that needs to be deleted
|
||||||
@ -390,7 +392,8 @@ paths:
|
|||||||
x-tags:
|
x-tags:
|
||||||
- tag: store
|
- tag: store
|
||||||
get:
|
get:
|
||||||
description: For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions
|
description: For valid response try integer IDs with value <= 5 or > 10. Other
|
||||||
|
values will generated exceptions
|
||||||
operationId: getOrderById
|
operationId: getOrderById
|
||||||
parameters:
|
parameters:
|
||||||
- description: ID of pet that needs to be fetched
|
- description: ID of pet that needs to be fetched
|
||||||
@ -1196,7 +1199,8 @@ paths:
|
|||||||
- tag: $another-fake?
|
- tag: $another-fake?
|
||||||
/fake/body-with-file-schema:
|
/fake/body-with-file-schema:
|
||||||
put:
|
put:
|
||||||
description: For this test, the body for this request much reference a schema named `File`.
|
description: For this test, the body for this request much reference a schema
|
||||||
|
named `File`.
|
||||||
operationId: testBodyWithFileSchema
|
operationId: testBodyWithFileSchema
|
||||||
requestBody:
|
requestBody:
|
||||||
content:
|
content:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user