Merge remote-tracking branch 'upstream/master' into 5609-rust-client-better-error-typing

This commit is contained in:
Benoît Courtine 2020-06-09 22:24:53 +02:00
commit 733fd9d601
3802 changed files with 69391 additions and 44318 deletions

View File

@ -4,7 +4,7 @@
### PR checklist ### PR checklist
- [ ] Read the [contribution guidelines](https://github.com/openapitools/openapi-generator/blob/master/CONTRIBUTING.md). - [ ] Read the [contribution guidelines](https://github.com/openapitools/openapi-generator/blob/master/CONTRIBUTING.md).
- [ ] If contributing template-only or documentation-only changes which will change sample output, [build the project](https://github.com/OpenAPITools/openapi-generator#14---build-projects) before. - [ ] If contributing template-only or documentation-only changes which will change sample output, [build the project](https://github.com/OpenAPITools/openapi-generator#14---build-projects) beforehand.
- [ ] Run the shell script(s) under `./bin/` (or Windows batch scripts under`.\bin\windows`) to update Petstore samples related to your fix. This is important, as CI jobs will verify _all_ generator outputs of your HEAD commit, and these must match the expectations made by your contribution. You only need to run `./bin/{LANG}-petstore.sh`, `./bin/openapi3/{LANG}-petstore.sh` if updating the code or mustache templates for a language (`{LANG}`) (e.g. php, ruby, python, etc). - [ ] Run the shell script `./bin/generate-samples.sh`to update all Petstore samples related to your fix. This is important, as CI jobs will verify _all_ generator outputs of your HEAD commit as it would merge with master. These must match the expectations made by your contribution. You may regenerate an individual generator by passing the relevant config(s) as an argument to the script, for example `./bin/generate-samples.sh bin/config/java*`.
- [ ] File the PR against the [correct branch](https://github.com/OpenAPITools/openapi-generator/wiki/Git-Branches): `master`, `4.3.x`, `5.0.x`. Default: `master`. - [ ] File the PR against the [correct branch](https://github.com/OpenAPITools/openapi-generator/wiki/Git-Branches): `master`, `4.3.x`, `5.0.x`. Default: `master`.
- [ ] Copy the [technical committee](https://github.com/openapitools/openapi-generator/#62---openapi-generator-technical-committee) to review the pull request if your PR is targeting a particular programming language. - [ ] Copy the [technical committee](https://github.com/openapitools/openapi-generator/#62---openapi-generator-technical-committee) to review the pull request if your PR is targeting a particular programming language.

View File

@ -101,6 +101,9 @@ before_install:
# install Qt5 # install Qt5
- sudo apt install -y --no-install-recommends qt5-default - sudo apt install -y --no-install-recommends qt5-default
- cmake --version - cmake --version
# perl dep
- cpanm --local-lib=~/perl5 local::lib && eval $(perl -I ~/perl5/lib/perl5/ -Mlocal::lib)
- cpanm --quiet --no-interactive Test::Exception Test::More Log::Any LWP::UserAgent URI::Query Module::Runtime DateTime Module::Find Moose::Role JSON || echo "Igorned failure from cpanm"
# show host table to confirm petstore.swagger.io is mapped to localhost # show host table to confirm petstore.swagger.io is mapped to localhost
- cat /etc/hosts - cat /etc/hosts
# show java version # show java version

View File

@ -38,6 +38,6 @@ steps:
# generate test scripts # generate test scripts
- /bin/bash bin/tests/run-all-test - /bin/bash bin/tests/run-all-test
# generate all petstore samples (client, servers, doc) # generate all petstore samples (client, servers, doc)
- /bin/bash bin/run-all-petstore - /bin/bash bin/generate-samples.sh
# generate all petstore samples (openapi3) # generate all petstore samples (openapi3)
- /bin/bash bin/openapi3/run-all-petstore - /bin/bash bin/generate-samples.sh bin/configs/other/*.yaml

View File

@ -38,7 +38,7 @@ workflows:
set -e set -e
sh bin/swift5-all.sh sh bin/generate-samples.sh bin/configs/swift5-*.yaml
- script@1.1.5: - script@1.1.5:
title: Run Swift5 tests title: Run Swift5 tests
inputs: inputs:

View File

@ -1,31 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
OpenAPI Petstore
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
OpenAPI spec version: 1.0.0
-->
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp2.0</TargetFramework>
<IsPackable>false</IsPackable>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\Org.OpenAPITools\Org.OpenAPITools.csproj">
<Name>Org.OpenAPITools</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="linux-logo.png" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.9.0" />
<PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.1" />
</ItemGroup>
</Project>

View File

@ -1,23 +0,0 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using System;
using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("Org.OpenAPITools.Test")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0")]
[assembly: System.Reflection.AssemblyProductAttribute("Org.OpenAPITools.Test")]
[assembly: System.Reflection.AssemblyTitleAttribute("Org.OpenAPITools.Test")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
// Generated by the MSBuild WriteCodeFragment class.

View File

@ -1,31 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
OpenAPI Petstore
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
OpenAPI spec version: 1.0.0
-->
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp2.0</TargetFramework>
<IsPackable>false</IsPackable>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\Org.OpenAPITools\Org.OpenAPITools.csproj">
<Name>Org.OpenAPITools</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="linux-logo.png" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.9.0" />
<PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.1" />
</ItemGroup>
</Project>

View File

@ -1,23 +0,0 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using System;
using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("Org.OpenAPITools.Test")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0")]
[assembly: System.Reflection.AssemblyProductAttribute("Org.OpenAPITools.Test")]
[assembly: System.Reflection.AssemblyTitleAttribute("Org.OpenAPITools.Test")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
// Generated by the MSBuild WriteCodeFragment class.

View File

@ -1,92 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
OpenAPI Petstore
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
The version of the OpenAPI document: 1.0.0
-->
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{19F1DEBC-DE5E-4517-8062-F000CD499087}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Org.OpenAPITools.Test</RootNamespace>
<AssemblyName>Org.OpenAPITools.Test</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.ComponentModel.DataAnnotations" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Runtime.Serialization" />
<Reference Include="System.Xml" />
<Reference Include="Newtonsoft.Json">
<HintPath Condition="Exists('$(SolutionDir)\packages')">$(SolutionDir)\packages\Newtonsoft.Json.12.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
<HintPath Condition="Exists('..\packages')">..\packages\Newtonsoft.Json.12.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
<HintPath Condition="Exists('..\..\packages')">..\..\packages\Newtonsoft.Json.12.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
<HintPath Condition="Exists('..\..\vendor')">..\..\vendor\Newtonsoft.Json.12.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="JsonSubTypes">
<HintPath Condition="Exists('$(SolutionDir)\packages')">$(SolutionDir)\packages\JsonSubTypes.1.6.0\lib\net45\JsonSubTypes.dll</HintPath>
<HintPath Condition="Exists('..\packages')">..\packages\JsonSubTypes.1.6.0\lib\net45\JsonSubTypes.dll</HintPath>
<HintPath Condition="Exists('..\..\packages')">..\..\packages\JsonSubTypes.1.6.0\lib\net45\JsonSubTypes.dll</HintPath>
<HintPath Condition="Exists('..\..\vendor')">..\..\vendor\JsonSubTypes.1.6.0\lib\net45\JsonSubTypes.dll</HintPath>
</Reference>
<Reference Include="RestSharp">
<HintPath Condition="Exists('$(SolutionDir)\packages')">$(SolutionDir)\packages\RestSharp.105.1.0\lib\net45\RestSharp.dll</HintPath>
<HintPath Condition="Exists('..\packages')">..\packages\RestSharp.105.1.0\lib\net45\RestSharp.dll</HintPath>
<HintPath Condition="Exists('..\..\packages')">..\..\packages\RestSharp.105.1.0\lib\net45\RestSharp.dll</HintPath>
<HintPath Condition="Exists('..\..\vendor')">..\..\vendor\RestSharp.105.1.0\lib\net45\RestSharp.dll</HintPath>
</Reference>
<Reference Include="nunit.framework">
<HintPath Condition="Exists('$(SolutionDir)\packages')">$(SolutionDir)\packages\NUnit.3.11.0\lib\net45\nunit.framework.dll</HintPath>
<HintPath Condition="Exists('..\packages')">..\packages\NUnit.3.11.0\lib\net45\nunit.framework.dll</HintPath>
<HintPath Condition="Exists('..\..\packages')">..\..\packages\NUnit.3.11.0\lib\net45\nunit.framework.dll</HintPath>
<HintPath Condition="Exists('..\..\vendor')">..\..\vendor\NUnit.3.11.0\lib\net45\nunit.framework.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="**\*.cs"
Exclude="obj\**"/>
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<Import Project="$(MsBuildToolsPath)\Microsoft.CSharp.targets" />
<ItemGroup>
<ProjectReference Include="..\Org.OpenAPITools\Org.OpenAPITools.csproj">
<Project>{321C8C3F-0156-40C1-AE42-D59761FB9B6C}</Project>
<Name>Org.OpenAPITools</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="linux-logo.png" />
</ItemGroup>
</Project>

View File

@ -1,15 +0,0 @@
package org.openapitools.client;
import org.junit.*;
import static org.junit.Assert.*;
public class ConfigurationTest {
@Test
public void testDefaultApiClient() {
ApiClient apiClient = Configuration.getDefaultApiClient();
assertNotNull(apiClient);
assertEquals("http://petstore.swagger.io:80/v2", apiClient.getBasePath());
assertFalse(apiClient.isDebugging());
}
}

View File

@ -1,33 +0,0 @@
package org.openapitools.client;
import org.junit.*;
import static org.junit.Assert.*;
public class StringUtilTest {
@Test
public void testContainsIgnoreCase() {
assertTrue(StringUtil.containsIgnoreCase(new String[]{"abc"}, "abc"));
assertTrue(StringUtil.containsIgnoreCase(new String[]{"abc"}, "ABC"));
assertTrue(StringUtil.containsIgnoreCase(new String[]{"ABC"}, "abc"));
assertTrue(StringUtil.containsIgnoreCase(new String[]{null, "abc"}, "ABC"));
assertTrue(StringUtil.containsIgnoreCase(new String[]{null, "abc"}, null));
assertFalse(StringUtil.containsIgnoreCase(new String[]{"abc"}, "def"));
assertFalse(StringUtil.containsIgnoreCase(new String[]{}, "ABC"));
assertFalse(StringUtil.containsIgnoreCase(new String[]{}, null));
}
@Test
public void testJoin() {
String[] array = {"aa", "bb", "cc"};
assertEquals("aa,bb,cc", StringUtil.join(array, ","));
assertEquals("aa, bb, cc", StringUtil.join(array, ", "));
assertEquals("aabbcc", StringUtil.join(array, ""));
assertEquals("aa bb cc", StringUtil.join(array, " "));
assertEquals("aa\nbb\ncc", StringUtil.join(array, "\n"));
assertEquals("", StringUtil.join(new String[]{}, ","));
assertEquals("abc", StringUtil.join(new String[]{"abc"}, ","));
}
}

View File

@ -1,291 +0,0 @@
package org.openapitools.client;
import org.openapitools.client.auth.*;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.*;
import org.junit.*;
import static org.junit.Assert.*;
public class ApiClientTest {
ApiClient apiClient = null;
@Before
public void setup() {
apiClient = new ApiClient();
}
@Test
public void testParseAndFormatDate() {
// default date format
String dateStr = "2015-11-07T03:49:09.356Z";
assertEquals(dateStr, apiClient.formatDate(apiClient.parseDate("2015-11-07T03:49:09.356+00:00")));
assertEquals(dateStr, apiClient.formatDate(apiClient.parseDate("2015-11-07T03:49:09.356Z")));
assertEquals(dateStr, apiClient.formatDate(apiClient.parseDate("2015-11-07T05:49:09.356+02:00")));
assertEquals(dateStr, apiClient.formatDate(apiClient.parseDate("2015-11-07T02:49:09.356-01:00")));
// custom date format: without milli-seconds, custom time zone
DateFormat format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssXXX", Locale.ROOT);
format.setTimeZone(TimeZone.getTimeZone("GMT+10"));
apiClient.setDateFormat(format);
dateStr = "2015-11-07T13:49:09+10:00";
assertEquals(dateStr, apiClient.formatDate(apiClient.parseDate("2015-11-07T03:49:09+00:00")));
assertEquals(dateStr, apiClient.formatDate(apiClient.parseDate("2015-11-07T03:49:09Z")));
assertEquals(dateStr, apiClient.formatDate(apiClient.parseDate("2015-11-07T00:49:09-03:00")));
assertEquals(dateStr, apiClient.formatDate(apiClient.parseDate("2015-11-07T13:49:09+10:00")));
}
@Test
public void testIsJsonMime() {
assertFalse(apiClient.isJsonMime(null));
assertFalse(apiClient.isJsonMime(""));
assertFalse(apiClient.isJsonMime("text/plain"));
assertFalse(apiClient.isJsonMime("application/xml"));
assertFalse(apiClient.isJsonMime("application/jsonp"));
assertFalse(apiClient.isJsonMime("example/json"));
assertFalse(apiClient.isJsonMime("example/foo+bar+jsonx"));
assertFalse(apiClient.isJsonMime("example/foo+bar+xjson"));
assertTrue(apiClient.isJsonMime("application/json"));
assertTrue(apiClient.isJsonMime("application/json; charset=UTF8"));
assertTrue(apiClient.isJsonMime("APPLICATION/JSON"));
assertTrue(apiClient.isJsonMime("application/problem+json"));
assertTrue(apiClient.isJsonMime("APPLICATION/PROBLEM+JSON"));
assertTrue(apiClient.isJsonMime("application/json\t"));
assertTrue(apiClient.isJsonMime("example/foo+bar+json"));
assertTrue(apiClient.isJsonMime("example/foo+json;x;y"));
assertTrue(apiClient.isJsonMime("example/foo+json\t;"));
assertTrue(apiClient.isJsonMime("Example/fOO+JSON"));
}
@Test
public void testSelectHeaderAccept() {
String[] accepts = {"application/json", "application/xml"};
assertEquals("application/json", apiClient.selectHeaderAccept(accepts));
accepts = new String[]{"APPLICATION/XML", "APPLICATION/JSON"};
assertEquals("APPLICATION/JSON", apiClient.selectHeaderAccept(accepts));
accepts = new String[]{"application/xml", "application/json; charset=UTF8"};
assertEquals("application/json; charset=UTF8", apiClient.selectHeaderAccept(accepts));
accepts = new String[]{"text/plain", "application/xml"};
assertEquals("text/plain,application/xml", apiClient.selectHeaderAccept(accepts));
accepts = new String[]{};
assertNull(apiClient.selectHeaderAccept(accepts));
}
@Test
public void testSelectHeaderContentType() {
String[] contentTypes = {"application/json", "application/xml"};
assertEquals("application/json", apiClient.selectHeaderContentType(contentTypes));
contentTypes = new String[]{"APPLICATION/JSON", "APPLICATION/XML"};
assertEquals("APPLICATION/JSON", apiClient.selectHeaderContentType(contentTypes));
contentTypes = new String[]{"application/xml", "application/json; charset=UTF8"};
assertEquals("application/json; charset=UTF8", apiClient.selectHeaderContentType(contentTypes));
contentTypes = new String[]{"text/plain", "application/xml"};
assertEquals("text/plain", apiClient.selectHeaderContentType(contentTypes));
contentTypes = new String[]{};
assertEquals("application/json", apiClient.selectHeaderContentType(contentTypes));
}
@Test
public void testGetAuthentications() {
Map<String, Authentication> auths = apiClient.getAuthentications();
Authentication auth = auths.get("api_key");
assertNotNull(auth);
assertTrue(auth instanceof ApiKeyAuth);
ApiKeyAuth apiKeyAuth = (ApiKeyAuth) auth;
assertEquals("header", apiKeyAuth.getLocation());
assertEquals("api_key", apiKeyAuth.getParamName());
auth = auths.get("petstore_auth");
assertTrue(auth instanceof OAuth);
assertSame(auth, apiClient.getAuthentication("petstore_auth"));
assertNull(auths.get("unknown"));
try {
auths.put("my_auth", new HttpBasicAuth());
fail("the authentications returned should not be modifiable");
} catch (UnsupportedOperationException e) {
}
}
@Test
public void testSetUsernameAndPassword() {
HttpBasicAuth auth = null;
for (Authentication _auth : apiClient.getAuthentications().values()) {
if (_auth instanceof HttpBasicAuth) {
auth = (HttpBasicAuth) _auth;
break;
}
}
auth.setUsername(null);
auth.setPassword(null);
apiClient.setUsername("my-username");
apiClient.setPassword("my-password");
assertEquals("my-username", auth.getUsername());
assertEquals("my-password", auth.getPassword());
// reset values
auth.setUsername(null);
auth.setPassword(null);
}
@Test
public void testSetApiKeyAndPrefix() {
ApiKeyAuth auth = null;
for (Authentication _auth : apiClient.getAuthentications().values()) {
if (_auth instanceof ApiKeyAuth) {
auth = (ApiKeyAuth) _auth;
break;
}
}
auth.setApiKey(null);
auth.setApiKeyPrefix(null);
apiClient.setApiKey("my-api-key");
apiClient.setApiKeyPrefix("Token");
assertEquals("my-api-key", auth.getApiKey());
assertEquals("Token", auth.getApiKeyPrefix());
// reset values
auth.setApiKey(null);
auth.setApiKeyPrefix(null);
}
@Test
public void testParameterToPairWhenNameIsInvalid() throws Exception {
List<Pair> pairs_a = apiClient.parameterToPair(null, new Integer(1));
List<Pair> pairs_b = apiClient.parameterToPair("", new Integer(1));
assertTrue(pairs_a.isEmpty());
assertTrue(pairs_b.isEmpty());
}
@Test
public void testParameterToPairWhenValueIsNull() throws Exception {
List<Pair> pairs = apiClient.parameterToPair("param-a", null);
assertTrue(pairs.isEmpty());
}
@Test
public void testParameterToPairWhenValueIsEmptyString() throws Exception {
// single empty string
List<Pair> pairs = apiClient.parameterToPair("param-a", " ");
assertEquals(1, pairs.size());
}
@Test
public void testParameterToPairWhenValueIsNotCollection() throws Exception {
String name = "param-a";
Integer value = 1;
List<Pair> pairs = apiClient.parameterToPair(name, value);
assertEquals(1, pairs.size());
assertEquals(value, Integer.valueOf(pairs.get(0).getValue()));
}
@Test
public void testParameterToPairWhenValueIsCollection() throws Exception {
List<Object> values = new ArrayList<Object>();
values.add("value-a");
values.add(123);
values.add(new Date());
List<Pair> pairs = apiClient.parameterToPair("param-a", values);
assertEquals(0, pairs.size());
}
@Test
public void testParameterToPairsWhenNameIsInvalid() throws Exception {
List<Integer> objects = new ArrayList<Integer>();
objects.add(new Integer(1));
List<Pair> pairs_a = apiClient.parameterToPairs("csv", null, objects);
List<Pair> pairs_b = apiClient.parameterToPairs("csv", "", objects);
assertTrue(pairs_a.isEmpty());
assertTrue(pairs_b.isEmpty());
}
@Test
public void testParameterToPairsWhenValueIsNull() throws Exception {
List<Pair> pairs = apiClient.parameterToPairs("csv", "param-a", null);
assertTrue(pairs.isEmpty());
}
@Test
public void testParameterToPairsWhenValueIsEmptyStrings() throws Exception {
// list of empty strings
List<String> strs = new ArrayList<String>();
strs.add(" ");
strs.add(" ");
strs.add(" ");
List<Pair> concatStrings = apiClient.parameterToPairs("csv", "param-a", strs);
assertEquals(1, concatStrings.size());
assertFalse(concatStrings.get(0).getValue().isEmpty()); // should contain some delimiters
}
@Test
public void testParameterToPairsWhenValueIsCollection() throws Exception {
Map<String, String> collectionFormatMap = new HashMap<String, String>();
collectionFormatMap.put("csv", ",");
collectionFormatMap.put("tsv", "\t");
collectionFormatMap.put("ssv", " ");
collectionFormatMap.put("pipes", "|");
collectionFormatMap.put("", ","); // no format, must default to csv
collectionFormatMap.put("unknown", ","); // all other formats, must default to csv
String name = "param-a";
List<Object> values = new ArrayList<Object>();
values.add("value-a");
values.add(123);
values.add(new Date());
// check for multi separately
List<Pair> multiPairs = apiClient.parameterToPairs("multi", name, values);
assertEquals(values.size(), multiPairs.size());
for (int i = 0; i < values.size(); i++) {
assertEquals(apiClient.escapeString(apiClient.parameterToString(values.get(i))), multiPairs.get(i).getValue());
}
// all other formats
for (String collectionFormat : collectionFormatMap.keySet()) {
List<Pair> pairs = apiClient.parameterToPairs(collectionFormat, name, values);
assertEquals(1, pairs.size());
String delimiter = collectionFormatMap.get(collectionFormat);
if (!delimiter.equals(",")) {
// commas are not escaped because they are reserved characters in URIs
delimiter = apiClient.escapeString(delimiter);
}
String[] pairValueSplit = pairs.get(0).getValue().split(delimiter);
// must equal input values
assertEquals(values.size(), pairValueSplit.length);
for (int i = 0; i < values.size(); i++) {
assertEquals(apiClient.escapeString(apiClient.parameterToString(values.get(i))), pairValueSplit[i]);
}
}
}
}

View File

@ -1,71 +0,0 @@
package org.openapitools.client.auth;
import java.util.HashMap;
import java.util.ArrayList;
import java.util.Map;
import java.util.List;
import org.openapitools.client.Pair;
import org.junit.*;
import static org.junit.Assert.*;
public class ApiKeyAuthTest {
@Test
public void testApplyToParamsInQuery() {
List<Pair> queryParams = new ArrayList<Pair>();
Map<String, String> headerParams = new HashMap<String, String>();
Map<String, String> cookieParams = new HashMap<String, String>();
ApiKeyAuth auth = new ApiKeyAuth("query", "api_key");
auth.setApiKey("my-api-key");
auth.applyToParams(queryParams, headerParams, cookieParams);
assertEquals(1, queryParams.size());
for (Pair queryParam : queryParams) {
assertEquals("my-api-key", queryParam.getValue());
}
// no changes to header or cookie parameters
assertEquals(0, headerParams.size());
assertEquals(0, cookieParams.size());
}
@Test
public void testApplyToParamsInHeaderWithPrefix() {
List<Pair> queryParams = new ArrayList<Pair>();
Map<String, String> headerParams = new HashMap<String, String>();
Map<String, String> cookieParams = new HashMap<String, String>();
ApiKeyAuth auth = new ApiKeyAuth("header", "X-API-TOKEN");
auth.setApiKey("my-api-token");
auth.setApiKeyPrefix("Token");
auth.applyToParams(queryParams, headerParams, cookieParams);
// no changes to query or cookie parameters
assertEquals(0, queryParams.size());
assertEquals(0, cookieParams.size());
assertEquals(1, headerParams.size());
assertEquals("Token my-api-token", headerParams.get("X-API-TOKEN"));
}
@Test
public void testApplyToParamsInCookieWithPrefix() {
List<Pair> queryParams = new ArrayList<Pair>();
Map<String, String> headerParams = new HashMap<String, String>();
Map<String, String> cookieParams = new HashMap<String, String>();
ApiKeyAuth auth = new ApiKeyAuth("cookie", "X-API-TOKEN");
auth.setApiKey("my-api-token");
auth.setApiKeyPrefix("Token");
auth.applyToParams(queryParams, headerParams, cookieParams);
// no changes to query or header parameters
assertEquals(0, queryParams.size());
assertEquals(0, headerParams.size());
assertEquals(1, cookieParams.size());
assertEquals("Token my-api-token", cookieParams.get("X-API-TOKEN"));
}
}

View File

@ -1,54 +0,0 @@
package org.openapitools.client.auth;
import java.util.HashMap;
import java.util.ArrayList;
import java.util.Map;
import java.util.List;
import org.openapitools.client.Pair;
import org.junit.*;
import static org.junit.Assert.*;
public class HttpBasicAuthTest {
HttpBasicAuth auth = null;
@Before
public void setup() {
auth = new HttpBasicAuth();
}
@Test
public void testApplyToParams() {
List<Pair> queryParams = new ArrayList<Pair>();
Map<String, String> headerParams = new HashMap<String, String>();
Map<String, String> cookieParams = new HashMap<String, String>();
auth.setUsername("my-username");
auth.setPassword("my-password");
auth.applyToParams(queryParams, headerParams, cookieParams);
// no changes to query or cookie parameters
assertEquals(0, queryParams.size());
assertEquals(0, cookieParams.size());
assertEquals(1, headerParams.size());
// the string below is base64-encoded result of "my-username:my-password" with the "Basic " prefix
String expected = "Basic bXktdXNlcm5hbWU6bXktcGFzc3dvcmQ=";
assertEquals(expected, headerParams.get("Authorization"));
// null username should be treated as empty string
auth.setUsername(null);
auth.applyToParams(queryParams, headerParams, cookieParams);
// the string below is base64-encoded result of ":my-password" with the "Basic " prefix
expected = "Basic Om15LXBhc3N3b3Jk";
assertEquals(expected, headerParams.get("Authorization"));
// null password should be treated as empty string
auth.setUsername("my-username");
auth.setPassword(null);
auth.applyToParams(queryParams, headerParams, cookieParams);
// the string below is base64-encoded result of "my-username:" with the "Basic " prefix
expected = "Basic bXktdXNlcm5hbWU6";
assertEquals(expected, headerParams.get("Authorization"));
}
}

View File

@ -1,63 +0,0 @@
package org.openapitools.client.model;
import org.junit.Test;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.ObjectWriter;
import com.fasterxml.jackson.databind.SerializationFeature;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
public class EnumValueTest {
@Test
public void testEnumClass() {
assertEquals(EnumClass._ABC.toString(), "_abc");
assertEquals(EnumClass._EFG.toString(), "-efg");
assertEquals(EnumClass._XYZ_.toString(), "(xyz)");
}
@Test
public void testEnumTest() {
// test enum value
EnumTest enumTest = new EnumTest();
enumTest.setEnumString(EnumTest.EnumStringEnum.LOWER);
enumTest.setEnumInteger(EnumTest.EnumIntegerEnum.NUMBER_1);
enumTest.setEnumNumber(EnumTest.EnumNumberEnum.NUMBER_1_DOT_1);
assertEquals(EnumTest.EnumStringEnum.UPPER.toString(), "UPPER");
assertEquals(EnumTest.EnumStringEnum.UPPER.getValue(), "UPPER");
assertEquals(EnumTest.EnumStringEnum.LOWER.toString(), "lower");
assertEquals(EnumTest.EnumStringEnum.LOWER.getValue(), "lower");
assertEquals(EnumTest.EnumIntegerEnum.NUMBER_1.toString(), "1");
assertTrue(EnumTest.EnumIntegerEnum.NUMBER_1.getValue() == 1);
assertEquals(EnumTest.EnumIntegerEnum.NUMBER_MINUS_1.toString(), "-1");
assertTrue(EnumTest.EnumIntegerEnum.NUMBER_MINUS_1.getValue() == -1);
assertEquals(EnumTest.EnumNumberEnum.NUMBER_1_DOT_1.toString(), "1.1");
assertTrue(EnumTest.EnumNumberEnum.NUMBER_1_DOT_1.getValue() == 1.1);
assertEquals(EnumTest.EnumNumberEnum.NUMBER_MINUS_1_DOT_2.toString(), "-1.2");
assertTrue(EnumTest.EnumNumberEnum.NUMBER_MINUS_1_DOT_2.getValue() == -1.2);
try {
// test serialization (object => json)
ObjectMapper mapper = new ObjectMapper();
mapper.enable(SerializationFeature.WRITE_ENUMS_USING_TO_STRING);
ObjectWriter ow = mapper.writer();
String json = ow.writeValueAsString(enumTest);
assertEquals(json, "{\"enum_string\":\"lower\",\"enum_string_required\":null,\"enum_integer\":1,\"enum_number\":1.1,\"outerEnum\":null}");
// test deserialization (json => object)
EnumTest fromString = mapper.readValue(json, EnumTest.class);
assertEquals(fromString.getEnumString().toString(), "lower");
assertEquals(fromString.getEnumInteger().toString(), "1");
assertEquals(fromString.getEnumNumber().toString(), "1.1");
} catch (Exception e) {
fail("Exception thrown during serialization/deserialzation of JSON: " + e.getMessage());
}
}
}

View File

@ -1,249 +0,0 @@
package org.openapitools.client;
import org.openapitools.client.auth.*;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.*;
import org.junit.*;
import static org.junit.Assert.*;
public class ApiClientTest {
ApiClient apiClient = null;
@Before
public void setup() {
apiClient = new ApiClient();
}
@Test
public void testParseAndFormatDate() {
// default date format
String dateStr = "2015-11-07T03:49:09.356Z";
assertEquals(dateStr, apiClient.formatDate(apiClient.parseDate("2015-11-07T03:49:09.356+00:00")));
assertEquals(dateStr, apiClient.formatDate(apiClient.parseDate("2015-11-07T03:49:09.356Z")));
assertEquals(dateStr, apiClient.formatDate(apiClient.parseDate("2015-11-07T05:49:09.356+02:00")));
assertEquals(dateStr, apiClient.formatDate(apiClient.parseDate("2015-11-07T02:49:09.356-01:00")));
// custom date format: without milli-seconds, custom time zone
DateFormat format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssXXX", Locale.ROOT);
format.setTimeZone(TimeZone.getTimeZone("GMT+10"));
apiClient.setDateFormat(format);
dateStr = "2015-11-07T13:49:09+10:00";
assertEquals(dateStr, apiClient.formatDate(apiClient.parseDate("2015-11-07T03:49:09+00:00")));
assertEquals(dateStr, apiClient.formatDate(apiClient.parseDate("2015-11-07T03:49:09Z")));
assertEquals(dateStr, apiClient.formatDate(apiClient.parseDate("2015-11-07T00:49:09-03:00")));
assertEquals(dateStr, apiClient.formatDate(apiClient.parseDate("2015-11-07T13:49:09+10:00")));
}
@Test
public void testIsJsonMime() {
assertFalse(apiClient.isJsonMime(null));
assertFalse(apiClient.isJsonMime(""));
assertFalse(apiClient.isJsonMime("text/plain"));
assertFalse(apiClient.isJsonMime("application/xml"));
assertFalse(apiClient.isJsonMime("application/jsonp"));
assertFalse(apiClient.isJsonMime("example/json"));
assertFalse(apiClient.isJsonMime("example/foo+bar+jsonx"));
assertFalse(apiClient.isJsonMime("example/foo+bar+xjson"));
assertTrue(apiClient.isJsonMime("application/json"));
assertTrue(apiClient.isJsonMime("application/json; charset=UTF8"));
assertTrue(apiClient.isJsonMime("APPLICATION/JSON"));
assertTrue(apiClient.isJsonMime("application/problem+json"));
assertTrue(apiClient.isJsonMime("APPLICATION/PROBLEM+JSON"));
assertTrue(apiClient.isJsonMime("application/json\t"));
assertTrue(apiClient.isJsonMime("example/foo+bar+json"));
assertTrue(apiClient.isJsonMime("example/foo+json;x;y"));
assertTrue(apiClient.isJsonMime("example/foo+json\t;"));
assertTrue(apiClient.isJsonMime("Example/fOO+JSON"));
}
@Test
public void testSelectHeaderAccept() {
String[] accepts = {"application/json", "application/xml"};
assertEquals("application/json", apiClient.selectHeaderAccept(accepts));
accepts = new String[]{"APPLICATION/XML", "APPLICATION/JSON"};
assertEquals("APPLICATION/JSON", apiClient.selectHeaderAccept(accepts));
accepts = new String[]{"application/xml", "application/json; charset=UTF8"};
assertEquals("application/json; charset=UTF8", apiClient.selectHeaderAccept(accepts));
accepts = new String[]{"text/plain", "application/xml"};
assertEquals("text/plain,application/xml", apiClient.selectHeaderAccept(accepts));
accepts = new String[]{};
assertNull(apiClient.selectHeaderAccept(accepts));
}
@Test
public void testSelectHeaderContentType() {
String[] contentTypes = {"application/json", "application/xml"};
assertEquals("application/json", apiClient.selectHeaderContentType(contentTypes));
contentTypes = new String[]{"APPLICATION/JSON", "APPLICATION/XML"};
assertEquals("APPLICATION/JSON", apiClient.selectHeaderContentType(contentTypes));
contentTypes = new String[]{"application/xml", "application/json; charset=UTF8"};
assertEquals("application/json; charset=UTF8", apiClient.selectHeaderContentType(contentTypes));
contentTypes = new String[]{"text/plain", "application/xml"};
assertEquals("text/plain", apiClient.selectHeaderContentType(contentTypes));
contentTypes = new String[]{};
assertEquals("application/json", apiClient.selectHeaderContentType(contentTypes));
}
@Test
public void testGetAuthentications() {
Map<String, Authentication> auths = apiClient.getAuthentications();
Authentication auth = auths.get("api_key");
assertNotNull(auth);
assertTrue(auth instanceof ApiKeyAuth);
ApiKeyAuth apiKeyAuth = (ApiKeyAuth) auth;
assertEquals("header", apiKeyAuth.getLocation());
assertEquals("api_key", apiKeyAuth.getParamName());
auth = auths.get("petstore_auth");
assertTrue(auth instanceof OAuth);
assertSame(auth, apiClient.getAuthentication("petstore_auth"));
assertNull(auths.get("unknown"));
try {
auths.put("my_auth", new HttpBasicAuth());
fail("the authentications returned should not be modifiable");
} catch (UnsupportedOperationException e) {
}
}
@Test
public void testSetUsernameAndPassword() {
HttpBasicAuth auth = null;
for (Authentication _auth : apiClient.getAuthentications().values()) {
if (_auth instanceof HttpBasicAuth) {
auth = (HttpBasicAuth) _auth;
break;
}
}
auth.setUsername(null);
auth.setPassword(null);
apiClient.setUsername("my-username");
apiClient.setPassword("my-password");
assertEquals("my-username", auth.getUsername());
assertEquals("my-password", auth.getPassword());
// reset values
auth.setUsername(null);
auth.setPassword(null);
}
@Test
public void testSetApiKeyAndPrefix() {
ApiKeyAuth auth = null;
for (Authentication _auth : apiClient.getAuthentications().values()) {
if (_auth instanceof ApiKeyAuth) {
auth = (ApiKeyAuth) _auth;
break;
}
}
auth.setApiKey(null);
auth.setApiKeyPrefix(null);
apiClient.setApiKey("my-api-key");
apiClient.setApiKeyPrefix("Token");
assertEquals("my-api-key", auth.getApiKey());
assertEquals("Token", auth.getApiKeyPrefix());
// reset values
auth.setApiKey(null);
auth.setApiKeyPrefix(null);
}
@Test
public void testParameterToPairsWhenNameIsInvalid() throws Exception {
List<Pair> pairs_a = apiClient.parameterToPairs("csv", null, new Integer(1));
List<Pair> pairs_b = apiClient.parameterToPairs("csv", "", new Integer(1));
assertTrue(pairs_a.isEmpty());
assertTrue(pairs_b.isEmpty());
}
@Test
public void testParameterToPairsWhenValueIsNull() throws Exception {
List<Pair> pairs = apiClient.parameterToPairs("csv", "param-a", null);
assertTrue(pairs.isEmpty());
}
@Test
public void testParameterToPairsWhenValueIsEmptyStrings() throws Exception {
// single empty string
List<Pair> pairs = apiClient.parameterToPairs("csv", "param-a", " ");
assertEquals(1, pairs.size());
// list of empty strings
List<String> strs = new ArrayList<String>();
strs.add(" ");
strs.add(" ");
strs.add(" ");
List<Pair> concatStrings = apiClient.parameterToPairs("csv", "param-a", strs);
assertEquals(1, concatStrings.size());
assertFalse(concatStrings.get(0).getValue().isEmpty()); // should contain some delimiters
}
@Test
public void testParameterToPairsWhenValueIsNotCollection() throws Exception {
String name = "param-a";
Integer value = 1;
List<Pair> pairs = apiClient.parameterToPairs("csv", name, value);
assertEquals(1, pairs.size());
assertEquals(value, Integer.valueOf(pairs.get(0).getValue()));
}
@Test
public void testParameterToPairsWhenValueIsCollection() throws Exception {
Map<String, String> collectionFormatMap = new HashMap<String, String>();
collectionFormatMap.put("csv", ",");
collectionFormatMap.put("tsv", "\t");
collectionFormatMap.put("ssv", " ");
collectionFormatMap.put("pipes", "\\|");
collectionFormatMap.put("", ","); // no format, must default to csv
collectionFormatMap.put("unknown", ","); // all other formats, must default to csv
String name = "param-a";
List<Object> values = new ArrayList<Object>();
values.add("value-a");
values.add(123);
values.add(new Date());
// check for multi separately
List<Pair> multiPairs = apiClient.parameterToPairs("multi", name, values);
assertEquals(values.size(), multiPairs.size());
// all other formats
for (String collectionFormat : collectionFormatMap.keySet()) {
List<Pair> pairs = apiClient.parameterToPairs(collectionFormat, name, values);
assertEquals(1, pairs.size());
String delimiter = collectionFormatMap.get(collectionFormat);
String[] pairValueSplit = pairs.get(0).getValue().split(delimiter);
// must equal input values
assertEquals(values.size(), pairValueSplit.length);
}
}
}

View File

@ -1,58 +0,0 @@
package org.openapitools.client;
import org.openapitools.client.model.Order;
import org.junit.Before;
import org.junit.Test;
import org.threeten.bp.OffsetDateTime;
import org.threeten.bp.ZoneId;
import org.threeten.bp.format.DateTimeFormatter;
import static org.junit.Assert.*;
public class JSONTest {
private JSON json = null;
private Order order = null;
@Before
public void setup() {
json = new ApiClient().getJSON();
order = new Order();
}
@Test
public void testDefaultDate() throws Exception {
final DateTimeFormatter dateFormat = DateTimeFormatter.ISO_OFFSET_DATE_TIME;
final String dateStr = "2015-11-07T14:11:05.267Z";
order.setShipDate(dateFormat.parse(dateStr, OffsetDateTime.FROM));
String str = json.getContext(null).writeValueAsString(order);
Order o = json.getContext(null).readValue(str, Order.class);
assertEquals(dateStr, dateFormat.format(o.getShipDate()));
}
@Test
public void testCustomDate() throws Exception {
final DateTimeFormatter dateFormat = DateTimeFormatter.ISO_OFFSET_DATE_TIME.withZone(ZoneId.of("Etc/GMT+2"));
final String dateStr = "2015-11-07T14:11:05-02:00";
order.setShipDate(dateFormat.parse(dateStr, OffsetDateTime.FROM));
String str = json.getContext(null).writeValueAsString(order);
Order o = json.getContext(null).readValue(str, Order.class);
assertEquals(dateStr, dateFormat.format(o.getShipDate()));
}
@Test
public void testSqlDateSerialization() throws Exception {
String str = json.getContext(null).writeValueAsString(new java.sql.Date(10));
assertEquals("\"1970-01-01\"", str);
}
@Test
public void testSqlDateDeserialization() throws Exception {
final String str = "1970-01-01";
java.sql.Date date = json.getContext(null).readValue("\"" + str + "\"", java.sql.Date.class);
assertEquals(date.toString(), str);
}
}

View File

@ -1,70 +0,0 @@
package org.openapitools.client.auth;
import java.util.HashMap;
import java.util.ArrayList;
import java.util.Map;
import java.util.List;
import org.openapitools.client.ApiException;
import org.openapitools.client.Pair;
import org.junit.*;
import static org.junit.Assert.*;
public class ApiKeyAuthTest {
@Test
public void testApplyToParamsInQuery() throws ApiException {
List<Pair> queryParams = new ArrayList<Pair>();
Map<String, String> headerParams = new HashMap<String, String>();
Map<String, String> cookieParams = new HashMap<String, String>();
ApiKeyAuth auth = new ApiKeyAuth("query", "api_key");
auth.setApiKey("my-api-key");
auth.applyToParams(queryParams, headerParams, cookieParams, null, null, null);
assertEquals(1, queryParams.size());
for (Pair queryParam : queryParams) {
assertEquals("my-api-key", queryParam.getValue());
}
// no changes to header or cookie parameters
assertEquals(0, headerParams.size());
assertEquals(0, cookieParams.size());
}
@Test
public void testApplyToParamsInHeaderWithPrefix() throws ApiException {
List<Pair> queryParams = new ArrayList<Pair>();
Map<String, String> headerParams = new HashMap<String, String>();
Map<String, String> cookieParams = new HashMap<String, String>();
ApiKeyAuth auth = new ApiKeyAuth("header", "X-API-TOKEN");
auth.setApiKey("my-api-token");
auth.setApiKeyPrefix("Token");
auth.applyToParams(queryParams, headerParams, cookieParams, null, null, null);
// no changes to query parameters
assertEquals(0, queryParams.size());
assertEquals(0, cookieParams.size());
assertEquals(1, headerParams.size());
assertEquals("Token my-api-token", headerParams.get("X-API-TOKEN"));
}
@Test
public void testApplyToParamsInCookieWithPrefix() throws ApiException {
List<Pair> queryParams = new ArrayList<Pair>();
Map<String, String> headerParams = new HashMap<String, String>();
Map<String, String> cookieParams = new HashMap<String, String>();
ApiKeyAuth auth = new ApiKeyAuth("cookie", "X-API-TOKEN");
auth.setApiKey("my-api-token");
auth.setApiKeyPrefix("Token");
auth.applyToParams(queryParams, headerParams, cookieParams, null, null, null);
// no changes to query or header parameters
assertEquals(0, queryParams.size());
assertEquals(0, headerParams.size());
assertEquals(1, cookieParams.size());
assertEquals("Token my-api-token", cookieParams.get("X-API-TOKEN"));
}
}

View File

@ -1,54 +0,0 @@
package org.openapitools.client.auth;
import java.util.HashMap;
import java.util.ArrayList;
import java.util.Map;
import java.util.List;
import org.openapitools.client.ApiException;
import org.openapitools.client.Pair;
import org.junit.*;
import static org.junit.Assert.*;
public class HttpBasicAuthTest {
HttpBasicAuth auth = null;
@Before
public void setup() {
auth = new HttpBasicAuth();
}
@Test
public void testApplyToParams() throws ApiException {
List<Pair> queryParams = new ArrayList<Pair>();
Map<String, String> headerParams = new HashMap<String, String>();
Map<String, String> cookieParams = new HashMap<String, String>();
auth.setUsername("my-username");
auth.setPassword("my-password");
auth.applyToParams(queryParams, headerParams, cookieParams, null, null, null);
// no changes to query parameters
assertEquals(0, queryParams.size());
assertEquals(1, headerParams.size());
// the string below is base64-encoded result of "my-username:my-password" with the "Basic " prefix
String expected = "Basic bXktdXNlcm5hbWU6bXktcGFzc3dvcmQ=";
assertEquals(expected, headerParams.get("Authorization"));
// null username should be treated as empty string
auth.setUsername(null);
auth.applyToParams(queryParams, headerParams, cookieParams, null, null, null);
// the string below is base64-encoded result of ":my-password" with the "Basic " prefix
expected = "Basic Om15LXBhc3N3b3Jk";
assertEquals(expected, headerParams.get("Authorization"));
// null password should be treated as empty string
auth.setUsername("my-username");
auth.setPassword(null);
auth.applyToParams(queryParams, headerParams, cookieParams, null, null, null);
// the string below is base64-encoded result of "my-username:" with the "Basic " prefix
expected = "Basic bXktdXNlcm5hbWU6";
assertEquals(expected, headerParams.get("Authorization"));
}
}

View File

@ -1,63 +0,0 @@
package org.openapitools.client.model;
import org.junit.Test;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.ObjectWriter;
import com.fasterxml.jackson.databind.SerializationFeature;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
public class EnumValueTest {
@Test
public void testEnumClass() {
assertEquals(EnumClass._ABC.toString(), "_abc");
assertEquals(EnumClass._EFG.toString(), "-efg");
assertEquals(EnumClass._XYZ_.toString(), "(xyz)");
}
@Test
public void testEnumTest() {
// test enum value
EnumTest enumTest = new EnumTest();
enumTest.setEnumString(EnumTest.EnumStringEnum.LOWER);
enumTest.setEnumInteger(EnumTest.EnumIntegerEnum.NUMBER_1);
enumTest.setEnumNumber(EnumTest.EnumNumberEnum.NUMBER_1_DOT_1);
assertEquals(EnumTest.EnumStringEnum.UPPER.toString(), "UPPER");
assertEquals(EnumTest.EnumStringEnum.UPPER.getValue(), "UPPER");
assertEquals(EnumTest.EnumStringEnum.LOWER.toString(), "lower");
assertEquals(EnumTest.EnumStringEnum.LOWER.getValue(), "lower");
assertEquals(EnumTest.EnumIntegerEnum.NUMBER_1.toString(), "1");
assertTrue(EnumTest.EnumIntegerEnum.NUMBER_1.getValue() == 1);
assertEquals(EnumTest.EnumIntegerEnum.NUMBER_MINUS_1.toString(), "-1");
assertTrue(EnumTest.EnumIntegerEnum.NUMBER_MINUS_1.getValue() == -1);
assertEquals(EnumTest.EnumNumberEnum.NUMBER_1_DOT_1.toString(), "1.1");
assertTrue(EnumTest.EnumNumberEnum.NUMBER_1_DOT_1.getValue() == 1.1);
assertEquals(EnumTest.EnumNumberEnum.NUMBER_MINUS_1_DOT_2.toString(), "-1.2");
assertTrue(EnumTest.EnumNumberEnum.NUMBER_MINUS_1_DOT_2.getValue() == -1.2);
try {
// test serialization (object => json)
ObjectMapper mapper = new ObjectMapper();
mapper.enable(SerializationFeature.WRITE_ENUMS_USING_TO_STRING);
ObjectWriter ow = mapper.writer();
String json = ow.writeValueAsString(enumTest);
assertEquals(json, "{\"enum_string\":\"lower\",\"enum_string_required\":null,\"enum_integer\":1,\"enum_number\":1.1,\"outerEnum\":null}");
// test deserialization (json => object)
EnumTest fromString = mapper.readValue(json, EnumTest.class);
assertEquals(fromString.getEnumString().toString(), "lower");
assertEquals(fromString.getEnumInteger().toString(), "1");
assertEquals(fromString.getEnumNumber().toString(), "1.1");
} catch (Exception e) {
fail("Exception thrown during serialization/deserialzation of JSON: " + e.getMessage());
}
}
}

View File

@ -1,347 +0,0 @@
package org.openapitools.client;
import okhttp3.OkHttpClient;
import org.openapitools.client.auth.*;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.TimeZone;
import org.junit.*;
import static org.junit.Assert.*;
import static org.hamcrest.CoreMatchers.*;
public class ApiClientTest {
ApiClient apiClient;
JSON json;
@Before
public void setup() {
apiClient = new ApiClient();
json = apiClient.getJSON();
}
@Test
public void testIsJsonMime() {
assertFalse(apiClient.isJsonMime(null));
assertFalse(apiClient.isJsonMime(""));
assertFalse(apiClient.isJsonMime("text/plain"));
assertFalse(apiClient.isJsonMime("application/xml"));
assertFalse(apiClient.isJsonMime("application/jsonp"));
assertFalse(apiClient.isJsonMime("example/json"));
assertFalse(apiClient.isJsonMime("example/foo+bar+jsonx"));
assertFalse(apiClient.isJsonMime("example/foo+bar+xjson"));
assertTrue(apiClient.isJsonMime("application/json"));
assertTrue(apiClient.isJsonMime("application/json; charset=UTF8"));
assertTrue(apiClient.isJsonMime("APPLICATION/JSON"));
assertTrue(apiClient.isJsonMime("application/problem+json"));
assertTrue(apiClient.isJsonMime("APPLICATION/PROBLEM+JSON"));
assertTrue(apiClient.isJsonMime("application/json\t"));
assertTrue(apiClient.isJsonMime("example/foo+bar+json"));
assertTrue(apiClient.isJsonMime("example/foo+json;x;y"));
assertTrue(apiClient.isJsonMime("example/foo+json\t;"));
assertTrue(apiClient.isJsonMime("Example/fOO+JSON"));
assertTrue(apiClient.isJsonMime("application/json-patch+json"));
}
@Test
public void testSelectHeaderAccept() {
String[] accepts = {"application/json", "application/xml"};
assertEquals("application/json", apiClient.selectHeaderAccept(accepts));
accepts = new String[]{"APPLICATION/XML", "APPLICATION/JSON"};
assertEquals("APPLICATION/JSON", apiClient.selectHeaderAccept(accepts));
accepts = new String[]{"application/xml", "application/json; charset=UTF8"};
assertEquals("application/json; charset=UTF8", apiClient.selectHeaderAccept(accepts));
accepts = new String[]{"text/plain", "application/xml"};
assertEquals("text/plain,application/xml", apiClient.selectHeaderAccept(accepts));
accepts = new String[]{};
assertNull(apiClient.selectHeaderAccept(accepts));
}
@Test
public void testSelectHeaderContentType() {
String[] contentTypes = {"application/json", "application/xml"};
assertEquals("application/json", apiClient.selectHeaderContentType(contentTypes));
contentTypes = new String[]{"APPLICATION/JSON", "APPLICATION/XML"};
assertEquals("APPLICATION/JSON", apiClient.selectHeaderContentType(contentTypes));
contentTypes = new String[]{"application/xml", "application/json; charset=UTF8"};
assertEquals("application/json; charset=UTF8", apiClient.selectHeaderContentType(contentTypes));
contentTypes = new String[]{"text/plain", "application/xml"};
assertEquals("text/plain", apiClient.selectHeaderContentType(contentTypes));
contentTypes = new String[]{};
assertEquals("application/json", apiClient.selectHeaderContentType(contentTypes));
}
@Test
public void testGetAuthentications() {
Map<String, Authentication> auths = apiClient.getAuthentications();
Authentication auth = auths.get("api_key");
assertNotNull(auth);
assertTrue(auth instanceof ApiKeyAuth);
ApiKeyAuth apiKeyAuth = (ApiKeyAuth) auth;
assertEquals("header", apiKeyAuth.getLocation());
assertEquals("api_key", apiKeyAuth.getParamName());
auth = auths.get("petstore_auth");
assertTrue(auth instanceof OAuth);
assertSame(auth, apiClient.getAuthentication("petstore_auth"));
assertNull(auths.get("unknown"));
try {
auths.put("my_auth", new HttpBasicAuth());
fail("the authentications returned should not be modifiable");
} catch (UnsupportedOperationException e) {
}
}
/*
@Test
public void testSetUsernameAndPassword() {
HttpBasicAuth auth = null;
for (Authentication _auth : apiClient.getAuthentications().values()) {
if (_auth instanceof HttpBasicAuth) {
auth = (HttpBasicAuth) _auth;
break;
}
}
auth.setUsername(null);
auth.setPassword(null);
apiClient.setUsername("my-username");
apiClient.setPassword("my-password");
assertEquals("my-username", auth.getUsername());
assertEquals("my-password", auth.getPassword());
// reset values
auth.setUsername(null);
auth.setPassword(null);
}
*/
@Test
public void testSetApiKeyAndPrefix() {
ApiKeyAuth auth = null;
for (Authentication _auth : apiClient.getAuthentications().values()) {
if (_auth instanceof ApiKeyAuth) {
auth = (ApiKeyAuth) _auth;
break;
}
}
auth.setApiKey(null);
auth.setApiKeyPrefix(null);
apiClient.setApiKey("my-api-key");
apiClient.setApiKeyPrefix("Token");
assertEquals("my-api-key", auth.getApiKey());
assertEquals("Token", auth.getApiKeyPrefix());
// reset values
auth.setApiKey(null);
auth.setApiKeyPrefix(null);
}
@Test
public void testGetAndSetConnectTimeout() {
// connect timeout defaults to 10 seconds
assertEquals(10000, apiClient.getConnectTimeout());
assertEquals(10000, apiClient.getHttpClient().connectTimeoutMillis());
apiClient.setConnectTimeout(0);
assertEquals(0, apiClient.getConnectTimeout());
assertEquals(0, apiClient.getHttpClient().connectTimeoutMillis());
apiClient.setConnectTimeout(10000);
}
@Test
public void testGetAndSetReadTimeout() {
// read timeout defaults to 10 seconds
assertEquals(10000, apiClient.getReadTimeout());
assertEquals(10000, apiClient.getHttpClient().readTimeoutMillis());
apiClient.setReadTimeout(0);
assertEquals(0, apiClient.getReadTimeout());
assertEquals(0, apiClient.getHttpClient().readTimeoutMillis());
apiClient.setReadTimeout(10000);
}
@Test
public void testGetAndSetWriteTimeout() {
// write timeout defaults to 10 seconds
assertEquals(10000, apiClient.getWriteTimeout());
assertEquals(10000, apiClient.getHttpClient().writeTimeoutMillis());
apiClient.setWriteTimeout(0);
assertEquals(0, apiClient.getWriteTimeout());
assertEquals(0, apiClient.getHttpClient().writeTimeoutMillis());
apiClient.setWriteTimeout(10000);
}
@Test
public void testParameterToPairWhenNameIsInvalid() throws Exception {
List<Pair> pairs_a = apiClient.parameterToPair(null, new Integer(1));
List<Pair> pairs_b = apiClient.parameterToPair("", new Integer(1));
assertTrue(pairs_a.isEmpty());
assertTrue(pairs_b.isEmpty());
}
@Test
public void testParameterToPairWhenValueIsNull() throws Exception {
List<Pair> pairs = apiClient.parameterToPair("param-a", null);
assertTrue(pairs.isEmpty());
}
@Test
public void testParameterToPairWhenValueIsEmptyString() throws Exception {
// single empty string
List<Pair> pairs = apiClient.parameterToPair("param-a", " ");
assertEquals(1, pairs.size());
}
@Test
public void testParameterToPairWhenValueIsNotCollection() throws Exception {
String name = "param-a";
Integer value = 1;
List<Pair> pairs = apiClient.parameterToPair(name, value);
assertEquals(1, pairs.size());
assertEquals(value, Integer.valueOf(pairs.get(0).getValue()));
}
@Test
public void testParameterToPairWhenValueIsCollection() throws Exception {
List<Object> values = new ArrayList<Object>();
values.add("value-a");
values.add(123);
values.add(new Date());
List<Pair> pairs = apiClient.parameterToPair("param-a", values);
assertEquals(0, pairs.size());
}
@Test
public void testParameterToPairsWhenNameIsInvalid() throws Exception {
List<Integer> objects = new ArrayList<Integer>();
objects.add(new Integer(1));
List<Pair> pairs_a = apiClient.parameterToPairs("csv", null, objects);
List<Pair> pairs_b = apiClient.parameterToPairs("csv", "", objects);
assertTrue(pairs_a.isEmpty());
assertTrue(pairs_b.isEmpty());
}
@Test
public void testParameterToPairsWhenValueIsNull() throws Exception {
List<Pair> pairs = apiClient.parameterToPairs("csv", "param-a", null);
assertTrue(pairs.isEmpty());
}
@Test
public void testParameterToPairsWhenValueIsEmptyStrings() throws Exception {
// list of empty strings
List<String> strs = new ArrayList<String>();
strs.add(" ");
strs.add(" ");
strs.add(" ");
List<Pair> concatStrings = apiClient.parameterToPairs("csv", "param-a", strs);
assertEquals(1, concatStrings.size());
assertFalse(concatStrings.get(0).getValue().isEmpty()); // should contain some delimiters
}
@Test
public void testParameterToPairsWhenValueIsCollection() throws Exception {
Map<String, String> collectionFormatMap = new HashMap<String, String>();
collectionFormatMap.put("csv", ",");
collectionFormatMap.put("tsv", "\t");
collectionFormatMap.put("ssv", " ");
collectionFormatMap.put("pipes", "|");
collectionFormatMap.put("", ","); // no format, must default to csv
collectionFormatMap.put("unknown", ","); // all other formats, must default to csv
String name = "param-a";
List<Object> values = new ArrayList<Object>();
values.add("value-a");
values.add(123);
values.add(new Date());
// check for multi separately
List<Pair> multiPairs = apiClient.parameterToPairs("multi", name, values);
assertEquals(values.size(), multiPairs.size());
for (int i = 0; i < values.size(); i++) {
assertEquals(apiClient.escapeString(apiClient.parameterToString(values.get(i))), multiPairs.get(i).getValue());
}
// all other formats
for (String collectionFormat : collectionFormatMap.keySet()) {
List<Pair> pairs = apiClient.parameterToPairs(collectionFormat, name, values);
assertEquals(1, pairs.size());
String delimiter = collectionFormatMap.get(collectionFormat);
if (!delimiter.equals(",")) {
// commas are not escaped because they are reserved characters in URIs
delimiter = apiClient.escapeString(delimiter);
}
String[] pairValueSplit = pairs.get(0).getValue().split(delimiter);
// must equal input values
assertEquals(values.size(), pairValueSplit.length);
for (int i = 0; i < values.size(); i++) {
assertEquals(apiClient.escapeString(apiClient.parameterToString(values.get(i))), pairValueSplit[i]);
}
}
}
@Test
public void testSanitizeFilename() {
assertEquals("sun", apiClient.sanitizeFilename("sun"));
assertEquals("sun.gif", apiClient.sanitizeFilename("sun.gif"));
assertEquals("sun.gif", apiClient.sanitizeFilename("../sun.gif"));
assertEquals("sun.gif", apiClient.sanitizeFilename("/var/tmp/sun.gif"));
assertEquals("sun.gif", apiClient.sanitizeFilename("./sun.gif"));
assertEquals("sun.gif", apiClient.sanitizeFilename("..\\sun.gif"));
assertEquals("sun.gif", apiClient.sanitizeFilename("\\var\\tmp\\sun.gif"));
assertEquals("sun.gif", apiClient.sanitizeFilename("c:\\var\\tmp\\sun.gif"));
assertEquals("sun.gif", apiClient.sanitizeFilename(".\\sun.gif"));
}
@Test
public void testNewHttpClient() {
OkHttpClient oldClient = apiClient.getHttpClient();
apiClient.setHttpClient(oldClient.newBuilder().build());
assertThat(apiClient.getHttpClient(), is(not(oldClient)));
}
/**
* Tests the invariant that the HttpClient for the ApiClient must never be null
*/
@Test(expected = NullPointerException.class)
public void testNullHttpClient() {
apiClient.setHttpClient(null);
}
}

View File

@ -1,202 +0,0 @@
package org.openapitools.client;
import com.google.gson.reflect.TypeToken;
import org.openapitools.client.model.Order;
import java.lang.Exception;
import java.lang.reflect.Type;
import java.nio.charset.StandardCharsets;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;
import java.util.Locale;
import java.util.TimeZone;
import okio.ByteString;
import org.junit.*;
import org.threeten.bp.LocalDate;
import org.threeten.bp.OffsetDateTime;
import org.threeten.bp.ZoneId;
import org.threeten.bp.ZoneOffset;
import org.threeten.bp.format.DateTimeFormatter;
import static org.junit.Assert.*;
public class JSONTest {
private ApiClient apiClient = null;
private JSON json = null;
private Order order = null;
@Before
public void setup() {
apiClient = new ApiClient();
json = apiClient.getJSON();
order = new Order();
}
@Test
public void testSqlDateTypeAdapter() {
final String str = "\"2015-11-07\"";
final java.sql.Date date = java.sql.Date.valueOf("2015-11-07");
assertEquals(str, json.serialize(date));
assertEquals(json.deserialize(str, java.sql.Date.class), date);
assertEquals(json.deserialize("\"2015-11-07T03:49:09.356" + getCurrentTimezoneOffset() + "\"", java.sql.Date.class).toString(), date.toString());
// custom date format: without day
DateFormat format = new SimpleDateFormat("yyyy-MM", Locale.ROOT);
apiClient.setSqlDateFormat(format);
String dateStr = "\"2015-11\"";
assertEquals(dateStr, json.serialize(json.deserialize("\"2015-11-07T03:49:09Z\"", java.sql.Date.class)));
assertEquals(dateStr, json.serialize(json.deserialize("\"2015-11\"", java.sql.Date.class)));
}
@Test
public void testDateTypeAdapter() {
Calendar cal = new GregorianCalendar(2015, 10, 7, 3, 49, 9);
cal.setTimeZone(TimeZone.getTimeZone("UTC"));
assertEquals(json.deserialize("\"2015-11-07T05:49:09+02\"", Date.class), cal.getTime());
cal.set(Calendar.MILLISECOND, 300);
assertEquals(json.deserialize("\"2015-11-07T03:49:09.3Z\"", Date.class), cal.getTime());
cal.set(Calendar.MILLISECOND, 356);
Date date = cal.getTime();
final String utcDate = "\"2015-11-07T03:49:09.356Z\"";
assertEquals(json.deserialize(utcDate, Date.class), date);
assertEquals(json.deserialize("\"2015-11-07T03:49:09.356+00:00\"", Date.class), date);
assertEquals(json.deserialize("\"2015-11-07T05:49:09.356+02:00\"", Date.class), date);
assertEquals(json.deserialize("\"2015-11-07T02:49:09.356-01:00\"", Date.class), date);
assertEquals(json.deserialize("\"2015-11-07T03:49:09.356Z\"", Date.class), date);
assertEquals(json.deserialize("\"2015-11-07T03:49:09.356+00\"", Date.class), date);
assertEquals(json.deserialize("\"2015-11-07T02:49:09.356-0100\"", Date.class), date);
assertEquals(json.deserialize("\"2015-11-07T03:49:09.356456789Z\"", Date.class), date);
assertEquals(utcDate, json.serialize(date));
// custom datetime format: without milli-seconds, custom time zone
DateFormat format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssXXX", Locale.ROOT);
format.setTimeZone(TimeZone.getTimeZone("GMT+10"));
apiClient.setDateFormat(format);
String dateStr = "\"2015-11-07T13:49:09+10:00\"";
assertEquals(dateStr, json.serialize(json.deserialize("\"2015-11-07T03:49:09+00:00\"", Date.class)));
assertEquals(dateStr, json.serialize(json.deserialize("\"2015-11-07T03:49:09Z\"", Date.class)));
assertEquals(dateStr, json.serialize(json.deserialize("\"2015-11-07T00:49:09-03:00\"", Date.class)));
try {
// invalid time zone format
json.deserialize("\"2015-11-07T03:49:09+00\"", Date.class);
fail("json parsing should fail");
} catch (RuntimeException e) {
// OK
}
try {
// unexpected miliseconds
json.deserialize("\"2015-11-07T03:49:09.000Z\"", Date.class);
fail("json parsing should fail");
} catch (RuntimeException e) {
// OK
}
}
@Test
public void testOffsetDateTimeTypeAdapter() {
final String str = "\"2016-09-09T08:02:03.123-03:00\"";
OffsetDateTime date = OffsetDateTime.of(2016, 9, 9, 8, 2, 3, 123000000, ZoneOffset.of("-3"));
assertEquals(str, json.serialize(date));
//Use toString() instead of isEqual to verify that the offset is preserved
assertEquals(json.deserialize(str, OffsetDateTime.class).toString(), date.toString());
}
@Test
public void testLocalDateTypeAdapter() {
final String str = "\"2016-09-09\"";
final LocalDate date = LocalDate.of(2016, 9, 9);
assertEquals(str, json.serialize(date));
assertEquals(json.deserialize(str, LocalDate.class), date);
}
@Test
public void testDefaultDate() throws Exception {
final DateTimeFormatter datetimeFormat = DateTimeFormatter.ISO_OFFSET_DATE_TIME;
final String dateStr = "2015-11-07T14:11:05.267Z";
order.setShipDate(datetimeFormat.parse(dateStr, OffsetDateTime.FROM));
String str = json.serialize(order);
Type type = new TypeToken<Order>() { }.getType();
Order o = json.deserialize(str, type);
assertEquals(dateStr, datetimeFormat.format(o.getShipDate()));
}
@Test
public void testCustomDate() throws Exception {
final DateTimeFormatter datetimeFormat = DateTimeFormatter.ISO_OFFSET_DATE_TIME.withZone(ZoneId.of("Etc/GMT+2"));
final String dateStr = "2015-11-07T14:11:05-02:00";
order.setShipDate(datetimeFormat.parse(dateStr, OffsetDateTime.FROM));
String str = json.serialize(order);
Type type = new TypeToken<Order>() { }.getType();
Order o = json.deserialize(str, type);
assertEquals(dateStr, datetimeFormat.format(o.getShipDate()));
}
@Test
public void testByteArrayTypeAdapterSerialization() {
// Arrange
final String expectedBytesAsString = "Let's pretend this a jpg or something";
final byte[] expectedBytes = expectedBytesAsString.getBytes(StandardCharsets.UTF_8);
// Act
String serializedBytesWithQuotes = json.serialize(expectedBytes);
// Assert
String serializedBytes = serializedBytesWithQuotes.substring(1, serializedBytesWithQuotes.length() - 1);
if (json.getGson().htmlSafe()) {
serializedBytes = serializedBytes.replaceAll("\\\\u003d", "=");
}
ByteString actualAsByteString = ByteString.decodeBase64(serializedBytes);
byte[] actualBytes = actualAsByteString.toByteArray();
assertEquals(expectedBytesAsString, new String(actualBytes, StandardCharsets.UTF_8));
}
@Test
public void testByteArrayTypeAdapterDeserialization() {
// Arrange
final String expectedBytesAsString = "Let's pretend this a jpg or something";
final byte[] expectedBytes = expectedBytesAsString.getBytes(StandardCharsets.UTF_8);
final ByteString expectedByteString = ByteString.of(expectedBytes);
final String serializedBytes = expectedByteString.base64();
final String serializedBytesWithQuotes = "\"" + serializedBytes + "\"";
Type type = new TypeToken<byte[]>() { }.getType();
// Act
byte[] actualDeserializedBytes = json.deserialize(serializedBytesWithQuotes, type);
// Assert
assertEquals(expectedBytesAsString, new String(actualDeserializedBytes, StandardCharsets.UTF_8));
}
// Obtained 22JAN2018 from stackoverflow answer by PuguaSoft https://stackoverflow.com/questions/11399491/java-timezone-offset
// Direct link https://stackoverflow.com/a/16680815/3166133
public static String getCurrentTimezoneOffset() {
TimeZone tz = TimeZone.getDefault();
Calendar cal = GregorianCalendar.getInstance(tz, Locale.ROOT);
int offsetInMillis = tz.getOffset(cal.getTimeInMillis());
String offset = String.format(Locale.ROOT,"%02d:%02d", Math.abs(offsetInMillis / 3600000), Math.abs((offsetInMillis / 60000) % 60));
offset = (offsetInMillis >= 0 ? "+" : "-") + offset;
return offset;
}
}

View File

@ -1,564 +0,0 @@
/*
* OpenAPI Petstore
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* OpenAPI spec version: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package org.openapitools.client.api;
import org.openapitools.client.ApiException;
import org.openapitools.client.model.Pet;
import org.openapitools.client.auth.*;
import org.openapitools.client.model.*;
import org.openapitools.client.*;
import java.lang.reflect.Type;
import java.util.Arrays;
import java.util.ArrayList;
import java.util.concurrent.ConcurrentLinkedQueue;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.ThreadLocalRandom;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileWriter;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.junit.*;
import static org.junit.Assert.*;
/**
* API tests for PetApi
*/
public class PetApiTest {
private PetApi api = new PetApi();
private static final Logger LOG = LoggerFactory.getLogger(PetApiTest.class);
// In the circle.yml file, /etc/host is configured with an entry to resolve petstore.swagger.io to 127.0.0.1
private static String basePath = "http://petstore.swagger.io:80/v2";
@Before
public void setup() {
// setup authentication
ApiKeyAuth apiKeyAuth = (ApiKeyAuth) api.getApiClient().getAuthentication("api_key");
apiKeyAuth.setApiKey("special-key");
api.getApiClient().setBasePath(basePath);
}
@Test
public void testApiClient() {
// the default api client is used
assertEquals(Configuration.getDefaultApiClient(), api.getApiClient());
assertNotNull(api.getApiClient());
assertEquals(basePath, api.getApiClient().getBasePath());
assertFalse(api.getApiClient().isDebugging());
ApiClient oldClient = api.getApiClient();
ApiClient newClient = new ApiClient();
newClient.setVerifyingSsl(true);
newClient.setBasePath("http://example.com");
newClient.setDebugging(true);
// set api client via constructor
api = new PetApi(newClient);
assertNotNull(api.getApiClient());
assertEquals("http://example.com", api.getApiClient().getBasePath());
assertTrue(api.getApiClient().isDebugging());
// set api client via setter method
api.setApiClient(oldClient);
assertNotNull(api.getApiClient());
assertEquals(basePath, api.getApiClient().getBasePath());
assertFalse(api.getApiClient().isDebugging());
}
@Test
public void testCreateAndGetPet() throws Exception {
Pet pet = createPet();
api.addPet(pet);
Pet fetched = api.getPetById(pet.getId());
assertPetMatches(pet, fetched);
api.deletePet(pet.getId(), null);
}
@Test
public void testCreateAndGetPetWithHttpInfo() throws Exception {
Pet pet = createPet();
api.addPetWithHttpInfo(pet);
ApiResponse<Pet> resp = api.getPetByIdWithHttpInfo(pet.getId());
assertEquals(200, resp.getStatusCode());
assertEquals("application/json", resp.getHeaders().get("Content-Type").get(0));
Pet fetched = resp.getData();
assertPetMatches(pet, fetched);
api.deletePet(pet.getId(), null);
}
@Test
public void testCreateAndGetPetAsync() throws Exception {
Pet pet = createPet();
api.addPet(pet);
// to store returned Pet or error message/exception
final Map<String, Object> result = new HashMap<String, Object>();
api.getPetByIdAsync(pet.getId(), new ApiCallback<Pet>() {
@Override
public void onFailure(ApiException e, int statusCode, Map<String, List<String>> responseHeaders) {
result.put("error", e.getMessage());
}
@Override
public void onSuccess(Pet pet, int statusCode, Map<String, List<String>> responseHeaders) {
result.put("pet", pet);
}
@Override
public void onUploadProgress(long bytesWritten, long contentLength, boolean done) {
//empty
}
@Override
public void onDownloadProgress(long bytesRead, long contentLength, boolean done) {
//empty
}
});
// wait for the asynchronous call to finish (at most 10 seconds)
final int maxTry = 10;
int tryCount = 1;
Pet fetched = null;
do {
if (tryCount > maxTry) fail("have not got result of getPetByIdAsync after 10 seconds");
Thread.sleep(1000);
tryCount += 1;
if (result.get("error") != null) fail((String) result.get("error"));
if (result.get("pet") != null) {
fetched = (Pet) result.get("pet");
break;
}
} while (result.isEmpty());
assertPetMatches(pet, fetched);
api.deletePet(pet.getId(), null);
}
@Test
public void testCreateAndGetPetAsyncInvalidID() throws Exception {
Pet pet = createPet();
api.addPet(pet);
// to store returned Pet or error message/exception
final Map<String, Object> result = new HashMap<String, Object>();
// test getting a nonexistent pet
result.clear();
api.getPetByIdAsync(-10000L, new ApiCallback<Pet>() {
@Override
public void onFailure(ApiException e, int statusCode, Map<String, List<String>> responseHeaders) {
result.put("exception", e);
}
@Override
public void onSuccess(Pet pet, int statusCode, Map<String, List<String>> responseHeaders) {
result.put("pet", pet);
}
@Override
public void onUploadProgress(long bytesWritten, long contentLength, boolean done) {
//empty
}
@Override
public void onDownloadProgress(long bytesRead, long contentLength, boolean done) {
//empty
}
});
// wait for the asynchronous call to finish (at most 10 seconds)
final int maxTry = 10;
int tryCount = 1;
Pet fetched = null;
ApiException exception = null;
do {
if (tryCount > maxTry) fail("have not got result of getPetByIdAsync after 10 seconds");
Thread.sleep(1000);
tryCount += 1;
if (result.get("pet") != null) fail("expected an error");
if (result.get("exception") != null) {
exception = (ApiException) result.get("exception");
break;
}
} while (result.isEmpty());
assertNotNull(exception);
assertEquals(404, exception.getCode());
assertEquals("Not Found", exception.getMessage());
assertEquals("application/json", exception.getResponseHeaders().get("Content-Type").get(0));
api.deletePet(pet.getId(), null);
}
@Test
public void testCreateAndGetMultiplePetsAsync() throws Exception {
Pet pet1 = createPet();
Pet pet2 = createPet();
final CountDownLatch addLatch = new CountDownLatch(2);
final TestApiCallback<Void> addCallback1 = new TestApiCallback<Void>(addLatch);
final TestApiCallback<Void> addCallback2 = new TestApiCallback<Void>(addLatch);
// Make 2 simultaneous calls
api.addPetAsync(pet1, addCallback1);
api.addPetAsync(pet2, addCallback2);
// wait for both asynchronous calls to finish (at most 10 seconds)
assertTrue(addLatch.await(10, TimeUnit.SECONDS));
assertTrue(addCallback1.isDone());
assertTrue(addCallback2.isDone());
if (!addCallback1.isSuccess()) throw addCallback1.getException();
if (!addCallback2.isSuccess()) throw addCallback2.getException();
assertValidProgress(addCallback1.getUploadProgress());
assertValidProgress(addCallback2.getUploadProgress());
final CountDownLatch getLatch = new CountDownLatch(3);
final TestApiCallback<Pet> getCallback1 = new TestApiCallback<Pet>(getLatch);
final TestApiCallback<Pet> getCallback2 = new TestApiCallback<Pet>(getLatch);
final TestApiCallback<Pet> getCallback3 = new TestApiCallback<Pet>(getLatch);
api.getPetByIdAsync(pet1.getId(), getCallback1);
api.getPetByIdAsync(pet2.getId(), getCallback2);
// Get nonexistent pet
api.getPetByIdAsync(-10000L, getCallback3);
// wait for all asynchronous calls to finish (at most 10 seconds)
assertTrue(getLatch.await(10, TimeUnit.SECONDS));
assertTrue(getCallback1.isDone());
assertTrue(getCallback2.isDone());
assertTrue(getCallback3.isDone());
if (!getCallback1.isSuccess()) throw getCallback1.getException();
if (!getCallback2.isSuccess()) throw getCallback2.getException();
assertPetMatches(pet1, getCallback1.getResult());
assertPetMatches(pet2, getCallback2.getResult());
assertValidProgress(getCallback1.getDownloadProgress());
assertValidProgress(getCallback2.getDownloadProgress());
// Last callback should fail with ApiException
assertFalse(getCallback3.isSuccess());
final ApiException exception = getCallback3.getException();
assertNotNull(exception);
assertEquals(404, exception.getCode());
api.deletePet(pet1.getId(), null);
api.deletePet(pet2.getId(), null);
}
@Test
public void testUpdatePet() throws Exception {
Pet pet = createPet();
api.addPet(pet);
pet.setName("programmer");
api.updatePet(pet);
Pet fetched = api.getPetById(pet.getId());
assertPetMatches(pet, fetched);
api.deletePet(pet.getId(), null);
}
@Test
public void testFindPetsByStatus() throws Exception {
assertEquals(basePath, api.getApiClient().getBasePath());
Pet pet = createPet();
api.addPet(pet);
pet.setName("programmer");
pet.setStatus(Pet.StatusEnum.PENDING);
api.updatePet(pet);
List<Pet> pets = api.findPetsByStatus(Arrays.asList("pending"));
assertNotNull(pets);
boolean found = false;
for (Pet fetched : pets) {
if (fetched.getId().equals(pet.getId())) {
found = true;
break;
}
}
assertTrue(found);
api.deletePet(pet.getId(), null);
}
@Test
@Ignore
public void testFindPetsByTags() throws Exception {
Pet pet = createPet();
pet.setName("monster");
pet.setStatus(Pet.StatusEnum.AVAILABLE);
List<Tag> tags = new ArrayList<Tag>();
Tag tag1 = new Tag();
tag1.setName("friendly");
tags.add(tag1);
pet.setTags(tags);
api.updatePet(pet);
Set<Pet> pets = api.findPetsByTags(new HashSet<>(Arrays.asList("friendly")));
assertNotNull(pets);
boolean found = false;
for (Pet fetched : pets) {
if (fetched.getId().equals(pet.getId())) {
found = true;
break;
}
}
assertTrue(found);
api.deletePet(pet.getId(), null);
}
@Test
public void testUpdatePetWithForm() throws Exception {
Pet pet = createPet();
pet.setName("frank");
api.addPet(pet);
Pet fetched = api.getPetById(pet.getId());
api.updatePetWithForm(fetched.getId(), "furt", null);
Pet updated = api.getPetById(fetched.getId());
assertEquals(updated.getName(), "furt");
api.deletePet(pet.getId(), null);
}
@Test
public void testDeletePet() throws Exception {
Pet pet = createPet();
api.addPet(pet);
Pet fetched = api.getPetById(pet.getId());
api.deletePet(pet.getId(), null);
try {
fetched = api.getPetById(fetched.getId());
fail("expected an error");
} catch (ApiException e) {
LOG.info("Code: {}. Message: {}", e.getCode(), e.getMessage());
assertEquals(404, e.getCode());
}
}
@Test
public void testUploadFile() throws Exception {
Pet pet = createPet();
api.addPet(pet);
File file = new File("hello.txt");
BufferedWriter writer = new BufferedWriter(new FileWriter(file));
writer.write("Hello world!");
writer.close();
api.uploadFile(pet.getId(), "a test file", new File(file.getAbsolutePath()));
api.deletePet(pet.getId(), null);
}
@Test
public void testEqualsAndHashCode() {
Pet pet1 = new Pet();
Pet pet2 = new Pet();
assertTrue(pet1.equals(pet2));
assertTrue(pet2.equals(pet1));
assertTrue(pet1.hashCode() == pet2.hashCode());
assertTrue(pet1.equals(pet1));
assertTrue(pet1.hashCode() == pet1.hashCode());
pet2.setName("really-happy");
pet2.setPhotoUrls(new HashSet<>(Arrays.asList("http://foo.bar.com/1", "http://foo.bar.com/2")));
assertFalse(pet1.equals(pet2));
assertFalse(pet2.equals(pet1));
assertFalse(pet1.hashCode() == (pet2.hashCode()));
assertTrue(pet2.equals(pet2));
assertTrue(pet2.hashCode() == pet2.hashCode());
pet1.setName("really-happy");
pet1.setPhotoUrls(new HashSet<>(Arrays.asList("http://foo.bar.com/1", "http://foo.bar.com/2")));
assertTrue(pet1.equals(pet2));
assertTrue(pet2.equals(pet1));
assertTrue(pet1.hashCode() == pet2.hashCode());
assertTrue(pet1.equals(pet1));
assertTrue(pet1.hashCode() == pet1.hashCode());
}
private Pet createPet() {
Pet pet = new Pet();
pet.setId(ThreadLocalRandom.current().nextLong(Long.MAX_VALUE));
pet.setName("gorilla");
Category category = new Category();
category.setName("really-happy");
pet.setCategory(category);
pet.setStatus(Pet.StatusEnum.AVAILABLE);
Set<String> photos = new HashSet<>(Arrays.asList("http://foo.bar.com/1", "http://foo.bar.com/2"));
pet.setPhotoUrls(photos);
return pet;
}
private String serializeJson(Object o, ApiClient apiClient) {
return apiClient.getJSON().serialize(o);
}
private <T> T deserializeJson(String json, Type type, ApiClient apiClient) {
return (T) apiClient.getJSON().deserialize(json, type);
}
private void assertPetMatches(Pet expected, Pet actual) {
assertNotNull(actual);
assertEquals(expected.getId(), actual.getId());
assertNotNull(actual.getCategory());
assertEquals(expected.getCategory().getName(),
actual.getCategory().getName());
}
/**
* Assert that the given upload/download progress list satisfies the
* following constraints:
* <p>
* - List is not empty
* - Byte count should be nondecreasing
* - The last element, and only the last element, should have done=true
*/
private void assertValidProgress(List<Progress> progressList) {
assertFalse(progressList.isEmpty());
Progress prev = null;
int index = 0;
for (Progress progress : progressList) {
if (prev != null) {
if (prev.done || prev.bytes > progress.bytes) {
fail("Progress list out of order at index " + index
+ ": " + progressList);
}
}
prev = progress;
index += 1;
}
if (!prev.done) {
fail("Last progress item should have done=true: " + progressList);
}
}
private static class TestApiCallback<T> implements ApiCallback<T> {
private final CountDownLatch latch;
private final ConcurrentLinkedQueue<Progress> uploadProgress =
new ConcurrentLinkedQueue<Progress>();
private final ConcurrentLinkedQueue<Progress> downloadProgress =
new ConcurrentLinkedQueue<Progress>();
private boolean done;
private boolean success;
private ApiException exception;
private T result;
public TestApiCallback(CountDownLatch latch) {
this.latch = latch;
this.done = false;
}
@Override
public void onFailure(ApiException e, int statusCode, Map<String, List<String>> responseHeaders) {
exception = e;
this.done = true;
this.success = false;
latch.countDown();
}
@Override
public void onSuccess(T result, int statusCode, Map<String, List<String>> responseHeaders) {
this.result = result;
this.done = true;
this.success = true;
latch.countDown();
}
@Override
public void onUploadProgress(long bytesWritten, long contentLength, boolean done) {
uploadProgress.add(new Progress(bytesWritten, contentLength, done));
}
@Override
public void onDownloadProgress(long bytesRead, long contentLength, boolean done) {
downloadProgress.add(new Progress(bytesRead, contentLength, done));
}
public boolean isDone() {
return done;
}
public boolean isSuccess() {
return success;
}
public ApiException getException() {
return exception;
}
public T getResult() {
return result;
}
public List<Progress> getUploadProgress() {
return new ArrayList<Progress>(uploadProgress);
}
public List<Progress> getDownloadProgress() {
return new ArrayList<Progress>(downloadProgress);
}
}
private static class Progress {
public final long bytes;
public final long contentLength;
public final boolean done;
public Progress(long bytes, long contentLength, boolean done) {
this.bytes = bytes;
this.contentLength = contentLength;
this.done = done;
}
@Override
public String toString() {
return "<Progress " + bytes + " " + contentLength + " " + done + ">";
}
}
}

View File

@ -1,119 +0,0 @@
package org.openapitools.client.auth;
import java.util.HashMap;
import java.util.ArrayList;
import java.util.Map;
import java.util.List;
import org.openapitools.client.Pair;
import org.junit.*;
import static org.junit.Assert.*;
public class ApiKeyAuthTest {
@Test
public void testApplyToParamsInQuery() {
List<Pair> queryParams = new ArrayList<Pair>();
Map<String, String> headerParams = new HashMap<String, String>();
Map<String, String> cookieParams = new HashMap<String, String>();
ApiKeyAuth auth = new ApiKeyAuth("query", "api_key");
auth.setApiKey("my-api-key");
auth.applyToParams(queryParams, headerParams, cookieParams);
assertEquals(1, queryParams.size());
for (Pair queryParam : queryParams) {
assertEquals("my-api-key", queryParam.getValue());
}
// no changes to header or cookie parameters
assertEquals(0, headerParams.size());
assertEquals(0, cookieParams.size());
}
@Test
public void testApplyToParamsInQueryWithNullValue() {
List<Pair> queryParams = new ArrayList<Pair>();
Map<String, String> headerParams = new HashMap<String, String>();
Map<String, String> cookieParams = new HashMap<String, String>();
ApiKeyAuth auth = new ApiKeyAuth("query", "api_key");
auth.setApiKey(null);
auth.applyToParams(queryParams, headerParams, cookieParams);
// no changes to parameters
assertEquals(0, queryParams.size());
assertEquals(0, headerParams.size());
assertEquals(0, cookieParams.size());
}
@Test
public void testApplyToParamsInHeaderWithPrefix() {
List<Pair> queryParams = new ArrayList<Pair>();
Map<String, String> headerParams = new HashMap<String, String>();
Map<String, String> cookieParams = new HashMap<String, String>();
ApiKeyAuth auth = new ApiKeyAuth("header", "X-API-TOKEN");
auth.setApiKey("my-api-token");
auth.setApiKeyPrefix("Token");
auth.applyToParams(queryParams, headerParams, cookieParams);
// no changes to query or cookie parameters
assertEquals(0, queryParams.size());
assertEquals(0, cookieParams.size());
assertEquals(1, headerParams.size());
assertEquals("Token my-api-token", headerParams.get("X-API-TOKEN"));
}
@Test
public void testApplyToParamsInHeaderWithNullValue() {
List<Pair> queryParams = new ArrayList<Pair>();
Map<String, String> headerParams = new HashMap<String, String>();
Map<String, String> cookieParams = new HashMap<String, String>();
ApiKeyAuth auth = new ApiKeyAuth("header", "X-API-TOKEN");
auth.setApiKey(null);
auth.setApiKeyPrefix("Token");
auth.applyToParams(queryParams, headerParams, cookieParams);
// no changes to parameters
assertEquals(0, queryParams.size());
assertEquals(0, cookieParams.size());
assertEquals(0, headerParams.size());
}
@Test
public void testApplyToParamsInCookieWithPrefix() {
List<Pair> queryParams = new ArrayList<Pair>();
Map<String, String> headerParams = new HashMap<String, String>();
Map<String, String> cookieParams = new HashMap<String, String>();
ApiKeyAuth auth = new ApiKeyAuth("cookie", "X-API-TOKEN");
auth.setApiKey("my-api-token");
auth.setApiKeyPrefix("Token");
auth.applyToParams(queryParams, headerParams, cookieParams);
// no changes to query or header parameters
assertEquals(0, queryParams.size());
assertEquals(0, headerParams.size());
assertEquals(1, cookieParams.size());
assertEquals("Token my-api-token", cookieParams.get("X-API-TOKEN"));
}
@Test
public void testApplyToParamsInCookieWithNullValue() {
List<Pair> queryParams = new ArrayList<Pair>();
Map<String, String> headerParams = new HashMap<String, String>();
Map<String, String> cookieParams = new HashMap<String, String>();
ApiKeyAuth auth = new ApiKeyAuth("cookie", "X-API-TOKEN");
auth.setApiKey(null);
auth.setApiKeyPrefix("Token");
auth.applyToParams(queryParams, headerParams, cookieParams);
// no changes to parameters
assertEquals(0, queryParams.size());
assertEquals(0, cookieParams.size());
assertEquals(0, headerParams.size());
}
}

View File

@ -1,64 +0,0 @@
package org.openapitools.client.auth;
import java.util.HashMap;
import java.util.ArrayList;
import java.util.Map;
import java.util.List;
import org.openapitools.client.Pair;
import org.junit.*;
import static org.junit.Assert.*;
public class HttpBasicAuthTest {
HttpBasicAuth auth = null;
@Before
public void setup() {
auth = new HttpBasicAuth();
}
@Test
public void testApplyToParams() {
List<Pair> queryParams = new ArrayList<Pair>();
Map<String, String> headerParams = new HashMap<String, String>();
Map<String, String> cookieParams = new HashMap<String, String>();
auth.setUsername("my-username");
auth.setPassword("my-password");
auth.applyToParams(queryParams, headerParams, cookieParams);
// no changes to query or cookie parameters
assertEquals(0, queryParams.size());
assertEquals(0, cookieParams.size());
assertEquals(1, headerParams.size());
// the string below is base64-encoded result of "my-username:my-password" with the "Basic " prefix
String expected = "Basic bXktdXNlcm5hbWU6bXktcGFzc3dvcmQ=";
assertEquals(expected, headerParams.get("Authorization"));
// null username should be treated as empty string
auth.setUsername(null);
auth.applyToParams(queryParams, headerParams, cookieParams);
// the string below is base64-encoded result of ":my-password" with the "Basic " prefix
expected = "Basic Om15LXBhc3N3b3Jk";
assertEquals(expected, headerParams.get("Authorization"));
// null password should be treated as empty string
auth.setUsername("my-username");
auth.setPassword(null);
auth.applyToParams(queryParams, headerParams, cookieParams);
// the string below is base64-encoded result of "my-username:" with the "Basic " prefix
expected = "Basic bXktdXNlcm5hbWU6";
assertEquals(expected, headerParams.get("Authorization"));
// null username and password should be ignored
queryParams = new ArrayList<Pair>();
headerParams = new HashMap<String, String>();
auth.setUsername(null);
auth.setPassword(null);
auth.applyToParams(queryParams, headerParams, cookieParams);
// no changes to parameters
assertEquals(0, queryParams.size());
assertEquals(0, headerParams.size());
}
}

View File

@ -1,72 +0,0 @@
/*
* OpenAPI Petstore
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* OpenAPI spec version: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package org.openapitools.client.model;
import org.apache.commons.lang3.builder.EqualsBuilder;
import com.google.gson.TypeAdapter;
import com.google.gson.annotations.JsonAdapter;
import com.google.gson.annotations.SerializedName;
import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonWriter;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.IOException;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;
/**
* Model tests for ArrayOfArrayOfNumberOnly
*/
public class ArrayOfArrayOfNumberOnlyTest {
private final ArrayOfArrayOfNumberOnly model = new ArrayOfArrayOfNumberOnly();
/**
* Model tests for ArrayOfArrayOfNumberOnly
*/
@Test
public void test() {
// TODO: test ArrayOfArrayOfNumberOnly
}
/**
* Test the property 'arrayArrayNumber'
*/
@Test
public void arrayArrayNumberTest() {
BigDecimal b1 = new BigDecimal("12.3");
BigDecimal b2 = new BigDecimal("5.6");
List<BigDecimal> arrayArrayNumber = new ArrayList<BigDecimal>();
arrayArrayNumber.add(b1);
arrayArrayNumber.add(b2);
model.setArrayArrayNumber(new ArrayList<List<BigDecimal>>());
model.getArrayArrayNumber().add(arrayArrayNumber);
// create another instance for comparison
BigDecimal b3 = new BigDecimal("12.3");
BigDecimal b4 = new BigDecimal("5.6");
ArrayOfArrayOfNumberOnly model2 = new ArrayOfArrayOfNumberOnly();
List<BigDecimal> arrayArrayNumber2 = new ArrayList<BigDecimal>();
arrayArrayNumber2.add(b1);
arrayArrayNumber2.add(b2);
model2.setArrayArrayNumber(new ArrayList<List<BigDecimal>>());
model2.getArrayArrayNumber().add(arrayArrayNumber2);
Assert.assertTrue(model2.equals(model));
}
}

View File

@ -1,56 +0,0 @@
package org.openapitools.client.model;
import org.junit.Test;
import com.google.gson.Gson;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
public class EnumValueTest {
@Test
public void testEnumClass() {
assertEquals(EnumClass._ABC.toString(), "_abc");
assertEquals(EnumClass._EFG.toString(), "-efg");
assertEquals(EnumClass._XYZ_.toString(), "(xyz)");
}
@Test
public void testEnumTest() {
// test enum value
EnumTest enumTest = new EnumTest();
enumTest.setEnumString(EnumTest.EnumStringEnum.LOWER);
enumTest.setEnumInteger(EnumTest.EnumIntegerEnum.NUMBER_1);
enumTest.setEnumNumber(EnumTest.EnumNumberEnum.NUMBER_1_DOT_1);
assertEquals(EnumTest.EnumStringEnum.UPPER.toString(), "UPPER");
assertEquals(EnumTest.EnumStringEnum.UPPER.getValue(), "UPPER");
assertEquals(EnumTest.EnumStringEnum.LOWER.toString(), "lower");
assertEquals(EnumTest.EnumStringEnum.LOWER.getValue(), "lower");
assertEquals(EnumTest.EnumIntegerEnum.NUMBER_1.toString(), "1");
assertTrue(EnumTest.EnumIntegerEnum.NUMBER_1.getValue() == 1);
assertEquals(EnumTest.EnumIntegerEnum.NUMBER_MINUS_1.toString(), "-1");
assertTrue(EnumTest.EnumIntegerEnum.NUMBER_MINUS_1.getValue() == -1);
assertEquals(EnumTest.EnumNumberEnum.NUMBER_1_DOT_1.toString(), "1.1");
assertTrue(EnumTest.EnumNumberEnum.NUMBER_1_DOT_1.getValue() == 1.1);
assertEquals(EnumTest.EnumNumberEnum.NUMBER_MINUS_1_DOT_2.toString(), "-1.2");
assertTrue(EnumTest.EnumNumberEnum.NUMBER_MINUS_1_DOT_2.getValue() == -1.2);
// test serialization
Gson gson = new Gson();
String json = gson.toJson(enumTest);
assertEquals(json, "{\"enum_string\":\"lower\",\"enum_integer\":1,\"enum_number\":1.1}");
// test deserialization
EnumTest fromString = gson.fromJson(json, EnumTest.class);
assertEquals(fromString.getEnumString().toString(), "lower");
assertEquals(fromString.getEnumString().getValue(), "lower");
assertEquals(fromString.getEnumInteger().toString(), "1");
assertTrue(fromString.getEnumInteger().getValue() == 1);
assertEquals(fromString.getEnumNumber().toString(), "1.1");
assertTrue(fromString.getEnumNumber().getValue() == 1.1);
}
}

View File

@ -1,253 +0,0 @@
package org.openapitools.client;
import org.openapitools.client.auth.*;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.*;
import org.junit.*;
import org.springframework.http.MediaType;
import org.springframework.util.MultiValueMap;
import static org.junit.Assert.*;
public class ApiClientTest {
ApiClient apiClient = null;
@Before
public void setup() {
apiClient = new ApiClient();
}
/**
*
*/
@Test
public void testParseAndFormatDate() {
// default date format
String dateStr = "2015-11-07T03:49:09.356Z";
assertEquals(dateStr, apiClient.formatDate(apiClient.parseDate("2015-11-07T03:49:09.356+00:00")));
assertEquals(dateStr, apiClient.formatDate(apiClient.parseDate("2015-11-07T03:49:09.356Z")));
assertEquals(dateStr, apiClient.formatDate(apiClient.parseDate("2015-11-07T05:49:09.356+02:00")));
assertEquals(dateStr, apiClient.formatDate(apiClient.parseDate("2015-11-07T02:49:09.356-01:00")));
// custom date format: without milli-seconds, custom time zone
DateFormat format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssXXX", Locale.ROOT);
format.setTimeZone(TimeZone.getTimeZone("GMT+10"));
apiClient.setDateFormat(format);
dateStr = "2015-11-07T13:49:09+10:00";
assertEquals(dateStr, apiClient.formatDate(apiClient.parseDate("2015-11-07T03:49:09+00:00")));
assertEquals(dateStr, apiClient.formatDate(apiClient.parseDate("2015-11-07T03:49:09Z")));
assertEquals(dateStr, apiClient.formatDate(apiClient.parseDate("2015-11-07T00:49:09-03:00")));
assertEquals(dateStr, apiClient.formatDate(apiClient.parseDate("2015-11-07T13:49:09+10:00")));
}
@Test
public void testIsJsonMime() {
assertFalse(apiClient.isJsonMime((String) null));
assertFalse(apiClient.isJsonMime(""));
assertFalse(apiClient.isJsonMime("text/plain"));
assertFalse(apiClient.isJsonMime("application/xml"));
assertFalse(apiClient.isJsonMime("application/jsonp"));
assertFalse(apiClient.isJsonMime("example/json"));
assertFalse(apiClient.isJsonMime("example/foo+bar+jsonx"));
assertFalse(apiClient.isJsonMime("example/foo+bar+xjson"));
assertTrue(apiClient.isJsonMime("application/json"));
assertTrue(apiClient.isJsonMime("application/json; charset=UTF8"));
assertTrue(apiClient.isJsonMime("APPLICATION/JSON"));
assertTrue(apiClient.isJsonMime("application/problem+json"));
assertTrue(apiClient.isJsonMime("APPLICATION/PROBLEM+JSON"));
assertTrue(apiClient.isJsonMime("application/json\t"));
assertTrue(apiClient.isJsonMime("example/foo+bar+json"));
assertTrue(apiClient.isJsonMime("example/foo+json;x;y"));
assertTrue(apiClient.isJsonMime("example/foo+json\t;"));
assertTrue(apiClient.isJsonMime("Example/fOO+JSON"));
}
@Test
public void testSelectHeaderAccept() {
String[] accepts = {"application/json", "application/xml"};
assertEquals(Arrays.asList(MediaType.parseMediaType("application/json")), apiClient.selectHeaderAccept(accepts));
accepts = new String[]{"APPLICATION/XML", "APPLICATION/JSON"};
assertEquals(Arrays.asList(MediaType.parseMediaType("APPLICATION/JSON")), apiClient.selectHeaderAccept(accepts));
accepts = new String[]{"application/xml", "application/json; charset=UTF8"};
assertEquals(Arrays.asList(MediaType.parseMediaType("application/json; charset=UTF8")), apiClient.selectHeaderAccept(accepts));
accepts = new String[]{"text/plain", "application/xml"};
assertEquals(Arrays.asList(MediaType.parseMediaType("text/plain"),MediaType.parseMediaType("application/xml")), apiClient.selectHeaderAccept(accepts));
accepts = new String[]{};
assertNull(apiClient.selectHeaderAccept(accepts));
}
@Test
public void testSelectHeaderContentType() {
String[] contentTypes = {"application/json", "application/xml"};
assertEquals(MediaType.parseMediaType("application/json"), apiClient.selectHeaderContentType(contentTypes));
contentTypes = new String[]{"APPLICATION/JSON", "APPLICATION/XML"};
assertEquals(MediaType.parseMediaType("APPLICATION/JSON"), apiClient.selectHeaderContentType(contentTypes));
contentTypes = new String[]{"application/xml", "application/json; charset=UTF8"};
assertEquals(MediaType.parseMediaType("application/json; charset=UTF8"), apiClient.selectHeaderContentType(contentTypes));
contentTypes = new String[]{"text/plain", "application/xml"};
assertEquals(MediaType.parseMediaType("text/plain"), apiClient.selectHeaderContentType(contentTypes));
contentTypes = new String[]{};
assertEquals(MediaType.parseMediaType("application/json"), apiClient.selectHeaderContentType(contentTypes));
}
@Test
public void testGetAuthentications() {
Map<String, Authentication> auths = apiClient.getAuthentications();
Authentication auth = auths.get("api_key");
assertNotNull(auth);
assertTrue(auth instanceof ApiKeyAuth);
ApiKeyAuth apiKeyAuth = (ApiKeyAuth) auth;
assertEquals("header", apiKeyAuth.getLocation());
assertEquals("api_key", apiKeyAuth.getParamName());
auth = auths.get("petstore_auth");
assertTrue(auth instanceof OAuth);
assertSame(auth, apiClient.getAuthentication("petstore_auth"));
assertNull(auths.get("unknown"));
try {
auths.put("my_auth", new HttpBasicAuth());
fail("the authentications returned should not be modifiable");
} catch (UnsupportedOperationException e) {
}
}
@Test
public void testSetUsernameAndPassword() {
HttpBasicAuth auth = null;
for (Authentication _auth : apiClient.getAuthentications().values()) {
if (_auth instanceof HttpBasicAuth) {
auth = (HttpBasicAuth) _auth;
break;
}
}
auth.setUsername(null);
auth.setPassword(null);
apiClient.setUsername("my-username");
apiClient.setPassword("my-password");
assertEquals("my-username", auth.getUsername());
assertEquals("my-password", auth.getPassword());
// reset values
auth.setUsername(null);
auth.setPassword(null);
}
@Test
public void testSetApiKeyAndPrefix() {
ApiKeyAuth auth = null;
for (Authentication _auth : apiClient.getAuthentications().values()) {
if (_auth instanceof ApiKeyAuth) {
auth = (ApiKeyAuth) _auth;
break;
}
}
auth.setApiKey(null);
auth.setApiKeyPrefix(null);
apiClient.setApiKey("my-api-key");
apiClient.setApiKeyPrefix("Token");
assertEquals("my-api-key", auth.getApiKey());
assertEquals("Token", auth.getApiKeyPrefix());
// reset values
auth.setApiKey(null);
auth.setApiKeyPrefix(null);
}
@Test
public void testParameterToMultiValueMapWhenNameIsInvalid() throws Exception {
MultiValueMap<String, String> pairs_a = apiClient.parameterToMultiValueMap(ApiClient.CollectionFormat.CSV, null, new Integer(1));
MultiValueMap<String, String> pairs_b = apiClient.parameterToMultiValueMap(ApiClient.CollectionFormat.CSV, "", new Integer(1));
assertTrue(pairs_a.isEmpty());
assertTrue(pairs_b.isEmpty());
}
@Test
public void testParameterToMultiValueMapWhenValueIsNull() throws Exception {
MultiValueMap<String, String> pairs = apiClient.parameterToMultiValueMap(ApiClient.CollectionFormat.CSV, "param-a", null);
assertTrue(pairs.isEmpty());
}
@Test
public void testParameterToMultiValueMapWhenValueIsEmptyStrings() throws Exception {
// single empty string
MultiValueMap<String, String> pairs = apiClient.parameterToMultiValueMap(ApiClient.CollectionFormat.CSV, "param-a", " ");
assertEquals(1, pairs.size());
// list of empty strings
List<String> strs = new ArrayList<String>();
strs.add(" ");
strs.add(" ");
strs.add(" ");
MultiValueMap<String, String> concatStrings = apiClient.parameterToMultiValueMap(ApiClient.CollectionFormat.CSV, "param-a", strs);
assertEquals(1, concatStrings.get("param-a").size());
assertFalse(concatStrings.get("param-a").isEmpty()); // should contain some delimiters
}
@Test
public void testParameterToMultiValueMapWhenValueIsNotCollection() throws Exception {
String name = "param-a";
Integer value = 1;
MultiValueMap<String, String> pairs = apiClient.parameterToMultiValueMap(ApiClient.CollectionFormat.CSV, name, value);
assertEquals(1, pairs.get(name).size());
assertEquals(value, Integer.valueOf(pairs.get(name).get(0)));
}
@Test
public void testParameterToMultiValueMapWhenValueIsCollection() throws Exception {
Map<ApiClient.CollectionFormat, String> collectionFormatMap = new HashMap<ApiClient.CollectionFormat, String>();
collectionFormatMap.put(ApiClient.CollectionFormat.CSV, ",");
collectionFormatMap.put(ApiClient.CollectionFormat.TSV, "\t");
collectionFormatMap.put(ApiClient.CollectionFormat.SSV, " ");
collectionFormatMap.put(ApiClient.CollectionFormat.PIPES, "\\|");
collectionFormatMap.put(null, ","); // no format, must default to csv
String name = "param-a";
List<Object> values = new ArrayList<Object>();
values.add("value-a");
values.add(123);
values.add(new Date());
// check for multi separately
MultiValueMap<String, String> multiValueMap = apiClient.parameterToMultiValueMap(ApiClient.CollectionFormat.MULTI, name, values);
assertEquals(values.size(), multiValueMap.get(name).size());
// all other formats
for (ApiClient.CollectionFormat collectionFormat : collectionFormatMap.keySet()) {
MultiValueMap<String, String> pairs = apiClient.parameterToMultiValueMap(collectionFormat, name, values);
assertEquals(1, pairs.size());
String delimiter = collectionFormatMap.get(collectionFormat);
String[] pairValueSplit = pairs.get(name).get(0).split(delimiter);
assertEquals(values.size(), pairValueSplit.length);
}
}
}

View File

@ -1,69 +0,0 @@
package org.openapitools.client.auth;
import java.util.HashMap;
import java.util.ArrayList;
import java.util.Map;
import java.util.List;
import org.junit.*;
import org.springframework.http.HttpHeaders;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;
import static org.junit.Assert.*;
public class ApiKeyAuthTest {
@Test
public void testApplyToParamsInQuery() {
MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<String, String>();
HttpHeaders headerParams = new HttpHeaders();
MultiValueMap<String, String> cookieParams = new LinkedMultiValueMap<String, String>();
ApiKeyAuth auth = new ApiKeyAuth("query", "api_key");
auth.setApiKey("my-api-key");
auth.applyToParams(queryParams, headerParams, cookieParams);
assertEquals(1, queryParams.size());
assertEquals("my-api-key", queryParams.get("api_key").get(0));
// no changes to header or cookie parameters
assertEquals(0, headerParams.size());
assertEquals(0, cookieParams.size());
}
@Test
public void testApplyToParamsInHeaderWithPrefix() {
MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<String, String>();
HttpHeaders headerParams = new HttpHeaders();
MultiValueMap<String, String> cookieParams = new LinkedMultiValueMap<String, String>();
ApiKeyAuth auth = new ApiKeyAuth("header", "X-API-TOKEN");
auth.setApiKey("my-api-token");
auth.setApiKeyPrefix("Token");
auth.applyToParams(queryParams, headerParams, cookieParams);
// no changes to query or cookie parameters
assertEquals(0, queryParams.size());
assertEquals(0, cookieParams.size());
assertEquals(1, headerParams.size());
assertEquals("Token my-api-token", headerParams.get("X-API-TOKEN").get(0));
}
@Test
public void testApplyToParamsInCookieWithPrefix() {
MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<String, String>();
HttpHeaders headerParams = new HttpHeaders();
MultiValueMap<String, String> cookieParams = new LinkedMultiValueMap<String, String>();
ApiKeyAuth auth = new ApiKeyAuth("cookie", "X-API-TOKEN");
auth.setApiKey("my-api-token");
auth.setApiKeyPrefix("Token");
auth.applyToParams(queryParams, headerParams, cookieParams);
// no changes to query or cookie parameters
assertEquals(0, queryParams.size());
assertEquals(0, headerParams.size());
assertEquals(1, cookieParams.size());
assertEquals("Token my-api-token", cookieParams.get("X-API-TOKEN").get(0));
}
}

View File

@ -1,56 +0,0 @@
package org.openapitools.client.auth;
import java.util.HashMap;
import java.util.ArrayList;
import java.util.Map;
import java.util.List;
import org.junit.*;
import org.springframework.http.HttpHeaders;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;
import static org.junit.Assert.*;
public class HttpBasicAuthTest {
HttpBasicAuth auth = null;
@Before
public void setup() {
auth = new HttpBasicAuth();
}
@Test
public void testApplyToParams() {
MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<String, String>();
HttpHeaders headerParams = new HttpHeaders();
MultiValueMap<String, String> cookieParams = new LinkedMultiValueMap<String, String>();
auth.setUsername("my-username");
auth.setPassword("my-password");
auth.applyToParams(queryParams, headerParams, cookieParams);
// no changes to query or cookie parameters
assertEquals(0, queryParams.size());
assertEquals(0, cookieParams.size());
assertEquals(1, headerParams.size());
// the string below is base64-encoded result of "my-username:my-password" with the "Basic " prefix
String expected = "Basic bXktdXNlcm5hbWU6bXktcGFzc3dvcmQ=";
assertEquals(expected, headerParams.get("Authorization").get(0));
// null username should be treated as empty string
auth.setUsername(null);
auth.applyToParams(queryParams, headerParams, cookieParams);
// the string below is base64-encoded result of ":my-password" with the "Basic " prefix
expected = "Basic Om15LXBhc3N3b3Jk";
assertEquals(expected, headerParams.get("Authorization").get(1));
// null password should be treated as empty string
auth.setUsername("my-username");
auth.setPassword(null);
auth.applyToParams(queryParams, headerParams, cookieParams);
// the string below is base64-encoded result of "my-username:" with the "Basic " prefix
expected = "Basic bXktdXNlcm5hbWU6";
assertEquals(expected, headerParams.get("Authorization").get(2));
}
}

View File

@ -1,63 +0,0 @@
package org.openapitools.client.model;
import org.junit.Test;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.ObjectWriter;
import com.fasterxml.jackson.databind.SerializationFeature;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
public class EnumValueTest {
@Test
public void testEnumClass() {
assertEquals(EnumClass._ABC.toString(), "_abc");
assertEquals(EnumClass._EFG.toString(), "-efg");
assertEquals(EnumClass._XYZ_.toString(), "(xyz)");
}
@Test
public void testEnumTest() {
// test enum value
EnumTest enumTest = new EnumTest();
enumTest.setEnumString(EnumTest.EnumStringEnum.LOWER);
enumTest.setEnumInteger(EnumTest.EnumIntegerEnum.NUMBER_1);
enumTest.setEnumNumber(EnumTest.EnumNumberEnum.NUMBER_1_DOT_1);
assertEquals(EnumTest.EnumStringEnum.UPPER.toString(), "UPPER");
assertEquals(EnumTest.EnumStringEnum.UPPER.getValue(), "UPPER");
assertEquals(EnumTest.EnumStringEnum.LOWER.toString(), "lower");
assertEquals(EnumTest.EnumStringEnum.LOWER.getValue(), "lower");
assertEquals(EnumTest.EnumIntegerEnum.NUMBER_1.toString(), "1");
assertTrue(EnumTest.EnumIntegerEnum.NUMBER_1.getValue() == 1);
assertEquals(EnumTest.EnumIntegerEnum.NUMBER_MINUS_1.toString(), "-1");
assertTrue(EnumTest.EnumIntegerEnum.NUMBER_MINUS_1.getValue() == -1);
assertEquals(EnumTest.EnumNumberEnum.NUMBER_1_DOT_1.toString(), "1.1");
assertTrue(EnumTest.EnumNumberEnum.NUMBER_1_DOT_1.getValue() == 1.1);
assertEquals(EnumTest.EnumNumberEnum.NUMBER_MINUS_1_DOT_2.toString(), "-1.2");
assertTrue(EnumTest.EnumNumberEnum.NUMBER_MINUS_1_DOT_2.getValue() == -1.2);
try {
// test serialization (object => json)
ObjectMapper mapper = new ObjectMapper();
mapper.enable(SerializationFeature.WRITE_ENUMS_USING_TO_STRING);
ObjectWriter ow = mapper.writer();
String json = ow.writeValueAsString(enumTest);
assertEquals(json, "{\"enum_string\":\"lower\",\"enum_string_required\":null,\"enum_integer\":1,\"enum_number\":1.1,\"outerEnum\":null}");
// test deserialization (json => object)
EnumTest fromString = mapper.readValue(json, EnumTest.class);
assertEquals(fromString.getEnumString().toString(), "lower");
assertEquals(fromString.getEnumInteger().toString(), "1");
assertEquals(fromString.getEnumNumber().toString(), "1.1");
} catch (Exception e) {
fail("Exception thrown during serialization/deserialzation of JSON: " + e.getMessage());
}
}
}

View File

@ -1,46 +0,0 @@
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>org.openapitools</groupId>
<artifactId>KotlinPetstoreThreetenbpTests</artifactId>
<packaging>pom</packaging>
<version>1.0-SNAPSHOT</version>
<name>kotlin-threetenbp</name>
<build>
<plugins>
<plugin>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.2.1</version>
<executions>
<execution>
<id>bundle-test</id>
<phase>integration-test</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>gradle</executable>
<arguments>
<argument>test</argument>
</arguments>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View File

@ -1,26 +0,0 @@
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>org.openapitools</groupId>
<artifactId>TypeScriptAngularBuildPestoreClientTests</artifactId>
<packaging>pom</packaging>
<version>1.0-SNAPSHOT</version>
<name>TS Fetch Default Petstore Client</name>
<build>
<plugins>
<plugin>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View File

@ -1,59 +0,0 @@
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>org.openapitools</groupId>
<artifactId>TypeScriptAngularBuildES6PestoreClientTests</artifactId>
<packaging>pom</packaging>
<version>1.0-SNAPSHOT</version>
<name>TS Fetch ES6 Petstore Client</name>
<build>
<plugins>
<plugin>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.2.1</version>
<executions>
<execution>
<id>npm-install</id>
<phase>integration-test</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>npm</executable>
<arguments>
<argument>install</argument>
</arguments>
</configuration>
</execution>
<execution>
<id>npm-test</id>
<phase>integration-test</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>npm</executable>
<arguments>
<argument>test</argument>
</arguments>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View File

@ -1,26 +0,0 @@
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>org.openapitools</groupId>
<artifactId>TypeScriptAngularBuildPestoreClientTests</artifactId>
<packaging>pom</packaging>
<version>1.0-SNAPSHOT</version>
<name>TS Fetch Multiple Parameters Petstore Client</name>
<build>
<plugins>
<plugin>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View File

@ -1,73 +0,0 @@
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>org.openapitools</groupId>
<artifactId>TypeScriptFetchBuildPrefixParameterInterfacesPestoreClientTests</artifactId>
<packaging>pom</packaging>
<version>1.0-SNAPSHOT</version>
<name>TS Fetch Petstore Client (with namespacing for parameter interfaces)</name>
<build>
<plugins>
<plugin>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.2.1</version>
<executions>
<execution>
<id>npm-install</id>
<phase>integration-test</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>npm</executable>
<arguments>
<argument>install</argument>
</arguments>
</configuration>
</execution>
<execution>
<id>npm-build</id>
<phase>integration-test</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>npm</executable>
<arguments>
<argument>run</argument>
<argument>build</argument>
</arguments>
</configuration>
</execution>
<execution>
<id>npm-test</id>
<phase>integration-test</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>npm</executable>
<arguments>
<argument>test</argument>
</arguments>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View File

@ -1,73 +0,0 @@
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>org.openapitools</groupId>
<artifactId>TypeScriptAngularBuildWithNPMVersionPestoreClientTests</artifactId>
<packaging>pom</packaging>
<version>1.0-SNAPSHOT</version>
<name>TS Fetch Petstore Client (with npm)</name>
<build>
<plugins>
<plugin>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.2.1</version>
<executions>
<execution>
<id>npm-install</id>
<phase>integration-test</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>npm</executable>
<arguments>
<argument>install</argument>
</arguments>
</configuration>
</execution>
<execution>
<id>npm-build</id>
<phase>integration-test</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>npm</executable>
<arguments>
<argument>run</argument>
<argument>build</argument>
</arguments>
</configuration>
</execution>
<execution>
<id>npm-test</id>
<phase>integration-test</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>npm</executable>
<arguments>
<argument>test</argument>
</arguments>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View File

@ -1,59 +0,0 @@
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>org.openapitools</groupId>
<artifactId>TypeScriptFetchPestoreClientTests</artifactId>
<packaging>pom</packaging>
<version>1.0-SNAPSHOT</version>
<name>TS Fetch Petstore Test Client</name>
<build>
<plugins>
<plugin>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.2.1</version>
<executions>
<execution>
<id>npm-install</id>
<phase>pre-integration-test</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>npm</executable>
<arguments>
<argument>install</argument>
</arguments>
</configuration>
</execution>
<execution>
<id>npm-test</id>
<phase>integration-test</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>npm</executable>
<arguments>
<argument>test</argument>
</arguments>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View File

@ -1,46 +0,0 @@
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>org.openapitools</groupId>
<artifactId>PlayServerTests-api-package-override</artifactId>
<packaging>pom</packaging>
<version>1.0-SNAPSHOT</version>
<name>java-play-framework-api-package-override Project</name>
<build>
<plugins>
<plugin>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.6.0</version>
<executions>
<execution>
<id>Play Test</id>
<phase>integration-test</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>sbt</executable>
<arguments>
<argument>test</argument>
</arguments>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View File

@ -1,46 +0,0 @@
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>org.openapitools</groupId>
<artifactId>PlayServerTests-controller-only</artifactId>
<packaging>pom</packaging>
<version>1.0-SNAPSHOT</version>
<name>java-play-framework-controller-only Project</name>
<build>
<plugins>
<plugin>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.6.0</version>
<executions>
<execution>
<id>Play Test</id>
<phase>integration-test</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>sbt</executable>
<arguments>
<argument>test</argument>
</arguments>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View File

@ -1,46 +0,0 @@
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>org.openapitools</groupId>
<artifactId>PlayServerTests-fake-endpoints</artifactId>
<packaging>pom</packaging>
<version>1.0-SNAPSHOT</version>
<name>java-play-framework-fake-endpoints Project</name>
<build>
<plugins>
<plugin>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.6.0</version>
<executions>
<execution>
<id>Play Test</id>
<phase>integration-test</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>sbt</executable>
<arguments>
<argument>test</argument>
</arguments>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View File

@ -1,46 +0,0 @@
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>org.openapitools</groupId>
<artifactId>PlayServerTests-no-bean-validation</artifactId>
<packaging>pom</packaging>
<version>1.0-SNAPSHOT</version>
<name>java-play-framework-no-bean-validation Project</name>
<build>
<plugins>
<plugin>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.6.0</version>
<executions>
<execution>
<id>Play Test</id>
<phase>integration-test</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>sbt</executable>
<arguments>
<argument>test</argument>
</arguments>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View File

@ -1,46 +0,0 @@
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>org.openapitools</groupId>
<artifactId>PlayServerTests-no-exception-handling</artifactId>
<packaging>pom</packaging>
<version>1.0-SNAPSHOT</version>
<name>java-play-framework-no-exception-handling Project</name>
<build>
<plugins>
<plugin>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.6.0</version>
<executions>
<execution>
<id>Play Test</id>
<phase>integration-test</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>sbt</executable>
<arguments>
<argument>test</argument>
</arguments>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View File

@ -1,46 +0,0 @@
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>org.openapitools</groupId>
<artifactId>PlayServerTests-no-interface</artifactId>
<packaging>pom</packaging>
<version>1.0-SNAPSHOT</version>
<name>java-play-framework-no-interface Project</name>
<build>
<plugins>
<plugin>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.6.0</version>
<executions>
<execution>
<id>Play Test</id>
<phase>integration-test</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>sbt</executable>
<arguments>
<argument>test</argument>
</arguments>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View File

@ -1,46 +0,0 @@
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>org.openapitools</groupId>
<artifactId>PlayServerTests-no-swagger-ui</artifactId>
<packaging>pom</packaging>
<version>1.0-SNAPSHOT</version>
<name>java-play-framework-no-swagger-ui Project</name>
<build>
<plugins>
<plugin>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.6.0</version>
<executions>
<execution>
<id>Play Test</id>
<phase>integration-test</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>sbt</executable>
<arguments>
<argument>test</argument>
</arguments>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View File

@ -1,46 +0,0 @@
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>org.openapitools</groupId>
<artifactId>PlayServerTests-no-wrap-calls</artifactId>
<packaging>pom</packaging>
<version>1.0-SNAPSHOT</version>
<name>java-play-framework-no-wrap-calls Project</name>
<build>
<plugins>
<plugin>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.6.0</version>
<executions>
<execution>
<id>Play Test</id>
<phase>integration-test</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>sbt</executable>
<arguments>
<argument>test</argument>
</arguments>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View File

@ -1,46 +0,0 @@
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>org.openapitools</groupId>
<artifactId>PlayServerTests</artifactId>
<packaging>pom</packaging>
<version>1.0-SNAPSHOT</version>
<name>java-play-framework Project</name>
<build>
<plugins>
<plugin>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.6.0</version>
<executions>
<execution>
<id>Play Test</id>
<phase>integration-test</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>sbt</executable>
<arguments>
<argument>test</argument>
</arguments>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View File

@ -1,46 +0,0 @@
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>org.openapitools</groupId>
<artifactId>KotlinPetstoreKtorTests</artifactId>
<packaging>pom</packaging>
<version>1.0-SNAPSHOT</version>
<name>kotlin-server-ktor</name>
<build>
<plugins>
<plugin>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.2.1</version>
<executions>
<execution>
<id>bundle-test</id>
<phase>integration-test</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>gradle</executable>
<arguments>
<argument>test</argument>
</arguments>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View File

@ -283,7 +283,7 @@ To generate code with this image, you'll need to mount a local location as a vol
Example: Example:
```sh ```sh
docker run --rm -v ${PWD}:/local openapitools/openapi-generator-cli generate \ docker run --rm -v "${PWD}:/local" openapitools/openapi-generator-cli generate \
-i https://raw.githubusercontent.com/openapitools/openapi-generator/master/modules/openapi-generator/src/test/resources/2_0/petstore.yaml \ -i https://raw.githubusercontent.com/openapitools/openapi-generator/master/modules/openapi-generator/src/test/resources/2_0/petstore.yaml \
-g go \ -g go \
-o /local/out/go -o /local/out/go
@ -598,6 +598,7 @@ Here are some companies/projects (alphabetical order) using OpenAPI Generator in
- [GoDaddy](https://godaddy.com) - [GoDaddy](https://godaddy.com)
- [Here](https://developer.here.com/) - [Here](https://developer.here.com/)
- [IBM](https://www.ibm.com/) - [IBM](https://www.ibm.com/)
- [Instana](https://www.instana.com)
- [JustStar](https://www.juststarinfo.com) - [JustStar](https://www.juststarinfo.com)
- [k6.io](https://k6.io/) - [k6.io](https://k6.io/)
- [Klarna](https://www.klarna.com/) - [Klarna](https://www.klarna.com/)

View File

@ -32,7 +32,7 @@ install:
- git clone https://github.com/wing328/swagger-samples - git clone https://github.com/wing328/swagger-samples
- ps: Start-Process -FilePath 'C:\maven\apache-maven-3.2.5\bin\mvn' -ArgumentList 'jetty:run' -WorkingDirectory "$env:appveyor_build_folder\swagger-samples\java\java-jersey-jaxrs-ci" - ps: Start-Process -FilePath 'C:\maven\apache-maven-3.2.5\bin\mvn' -ArgumentList 'jetty:run' -WorkingDirectory "$env:appveyor_build_folder\swagger-samples\java\java-jersey-jaxrs-ci"
- ps: $PSVersionTable.PSVersion - ps: $PSVersionTable.PSVersion
- ps: Install-Module Pester -Force -Scope CurrentUser -RequiredVersion 4.3.1 - ps: Install-Module Pester -Force -Scope CurrentUser
build_script: build_script:
- dotnet --info - dotnet --info
# build C# API client (netcore) # build C# API client (netcore)
@ -50,10 +50,8 @@ build_script:
# install openapi-generator locally # install openapi-generator locally
- mvn --no-snapshot-updates --quiet clean install -Dorg.slf4j.simpleLogger.defaultLogLevel=error - mvn --no-snapshot-updates --quiet clean install -Dorg.slf4j.simpleLogger.defaultLogLevel=error
# run the locally installed openapi-generator-gradle-plugin # run the locally installed openapi-generator-gradle-plugin
- gradle -b modules\openapi-generator-gradle-plugin\samples\local-spec\build.gradle buildGoSdk --info - gradle -b modules\openapi-generator-gradle-plugin\samples\local-spec\build.gradle buildGoSdk --stacktrace
test_script: test_script:
# restore test-related files
- copy /b/v/y CI\samples.ci\client\petstore\csharp\OpenAPIClient\src\Org.OpenAPITools.Test\Org.OpenAPITools.Test.csproj samples\client\petstore\csharp\OpenAPIClient\src\Org.OpenAPITools.Test\Org.OpenAPITools.Test.csproj
# test c# API client (netcore) # test c# API client (netcore)
- dotnet test samples\client\petstore\csharp-netcore\OpenAPIClient\src\Org.OpenAPITools.Test\Org.OpenAPITools.Test.csproj - dotnet test samples\client\petstore\csharp-netcore\OpenAPIClient\src\Org.OpenAPITools.Test\Org.OpenAPITools.Test.csproj
- dotnet test samples\client\petstore\csharp-netcore\OpenAPIClientCore\src\Org.OpenAPITools.Test\Org.OpenAPITools.Test.csproj - dotnet test samples\client\petstore\csharp-netcore\OpenAPIClientCore\src\Org.OpenAPITools.Test\Org.OpenAPITools.Test.csproj
@ -62,11 +60,12 @@ test_script:
# test c# API client (with PropertyChanged) # test c# API client (with PropertyChanged)
- nunit3-console samples\client\petstore\csharp\OpenAPIClientWithPropertyChanged\src\Org.OpenAPITools.Test\bin\Debug\Org.OpenAPITools.Test.dll --result=myresults.xml;format=AppVeyor - nunit3-console samples\client\petstore\csharp\OpenAPIClientWithPropertyChanged\src\Org.OpenAPITools.Test\bin\Debug\Org.OpenAPITools.Test.dll --result=myresults.xml;format=AppVeyor
### TODO: Execute all generators via powershell or other
# generate all petstore clients # generate all petstore clients
- .\bin\windows\run-all-petstore.cmd # - .\bin\windows\run-all-petstore.cmd
# generate all petstore clients (openapi3) # generate all petstore clients (openapi3)
- .\bin\openapi3\windows\run-all-petstore.cmd # - .\bin\openapi3\windows\run-all-petstore.cmd
# test ps pestore # test ps pestore
- ps: | - ps: |
$ErrorActionPreference = "Stop" $ErrorActionPreference = "Stop"

View File

@ -1,36 +0,0 @@
#!/usr/bin/env bash
SCRIPT="$0"
echo "# START SCRIPT: $SCRIPT"
while [ -h "$SCRIPT" ] ; do
ls=`ls -ld "$SCRIPT"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
SCRIPT="$link"
else
SCRIPT=`dirname "$SCRIPT"`/"$link"
fi
done
if [ ! -d "${APP_DIR}" ]; then
APP_DIR=`dirname "$SCRIPT"`/..
APP_DIR=`cd "${APP_DIR}"; pwd`
fi
executable="./modules/openapi-generator-cli/target/openapi-generator-cli.jar"
if [ ! -f "$executable" ]
then
mvn -B clean package
fi
# if you've executed sbt assembly previously it will use that instead.
export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties"
model="modules/openapi-generator/src/test/resources/2_0/petstore.yaml"
ags="generate --template-dir modules/openapi-generator/src/main/resources/Ada -g ada $@"
ags="$ags -i $model -t modules/openapi-generator/src/main/resources/Ada -o samples/client/petstore/ada"
ags="$ags --additional-properties projectName=Petstore --model-package Samples.Petstore"
java $JAVA_OPTS -jar $executable $ags
rm -rf samples/client/petstore/ada/src/server

View File

@ -1,5 +0,0 @@
#!/bin/sh
./bin/android-petstore-httpclient.sh
./bin/android-petstore-volley.sh

View File

@ -1,32 +0,0 @@
#!/bin/sh
SCRIPT="$0"
echo "# START SCRIPT: $SCRIPT"
while [ -h "$SCRIPT" ] ; do
ls=`ls -ld "$SCRIPT"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
SCRIPT="$link"
else
SCRIPT=`dirname "$SCRIPT"`/"$link"
fi
done
if [ ! -d "${APP_DIR}" ]; then
APP_DIR=`dirname "$SCRIPT"`/..
APP_DIR=`cd "${APP_DIR}"; pwd`
fi
executable="./modules/openapi-generator-cli/target/openapi-generator-cli.jar"
if [ ! -f "$executable" ]
then
mvn -B clean package
fi
# if you've executed sbt assembly previously it will use that instead.
export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties"
ags="generate -t modules/openapi-generator/src/main/resources/android -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g android --additional-properties library=httpclient -o samples/client/petstore/android/httpclient $@"
java $JAVA_OPTS -jar $executable $ags

View File

@ -1,4 +0,0 @@
{
"library": "volley",
"artifactId": "petstore-android-volley"
}

View File

@ -1,32 +0,0 @@
#!/bin/sh
SCRIPT="$0"
echo "# START SCRIPT: $SCRIPT"
while [ -h "$SCRIPT" ] ; do
ls=`ls -ld "$SCRIPT"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
SCRIPT="$link"
else
SCRIPT=`dirname "$SCRIPT"`/"$link"
fi
done
if [ ! -d "${APP_DIR}" ]; then
APP_DIR=`dirname "$SCRIPT"`/..
APP_DIR=`cd "${APP_DIR}"; pwd`
fi
executable="./modules/openapi-generator-cli/target/openapi-generator-cli.jar"
if [ ! -f "$executable" ]
then
mvn -B clean package
fi
# if you've executed sbt assembly previously it will use that instead.
export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties"
ags="generate -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g android -c bin/android-petstore-volley.json -o samples/client/petstore/android/volley $@"
java $JAVA_OPTS -jar $executable $ags

View File

@ -1,32 +0,0 @@
#!/usr/bin/env bash
SCRIPT="$0"
echo "# START SCRIPT: $SCRIPT"
while [ -h "$SCRIPT" ] ; do
ls=`ls -ld "$SCRIPT"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
SCRIPT="$link"
else
SCRIPT=`dirname "$SCRIPT"`/"$link"
fi
done
if [ ! -d "${APP_DIR}" ]; then
APP_DIR=`dirname "$SCRIPT"`/..
APP_DIR=`cd "${APP_DIR}"; pwd`
fi
executable="./modules/openapi-generator-cli/target/openapi-generator-cli.jar"
if [ ! -f "$executable" ]
then
mvn -B clean package
fi
# if you've executed sbt assembly previously it will use that instead.
export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties"
ags="generate -g apache2 -t modules/openapi-generator/src/main/resources/apache2/ -i modules/openapi-generator/src/test/resources/3_0/petstore.yaml -o samples/config/petstore/apache2 $@"
java $JAVA_OPTS -jar $executable $ags

View File

@ -1,32 +0,0 @@
#!/bin/sh
SCRIPT="$0"
echo "# START SCRIPT: $SCRIPT"
while [ -h "$SCRIPT" ] ; do
ls=`ls -ld "$SCRIPT"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
SCRIPT="$link"
else
SCRIPT=`dirname "$SCRIPT"`/"$link"
fi
done
if [ ! -d "${APP_DIR}" ]; then
APP_DIR=`dirname "$SCRIPT"`/..
APP_DIR=`cd "${APP_DIR}"; pwd`
fi
executable="./modules/openapi-generator-cli/target/openapi-generator-cli.jar"
if [ ! -f "$executable" ]
then
mvn -B clean package
fi
# if you've executed sbt assembly previously it will use that instead.
export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties"
ags="generate -t modules/openapi-generator/src/main/resources/apex -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g apex -o samples/client/petstore/apex $@"
java $JAVA_OPTS -jar $executable $ags

View File

@ -1,31 +0,0 @@
#!/bin/sh
SCRIPT="$0"
while [ -h "$SCRIPT" ] ; do
ls=$(ls -ld "$SCRIPT")
link=$(expr "$ls" : '.*-> \(.*\)$')
if expr "$link" : '/.*' > /dev/null; then
SCRIPT="$link"
else
SCRIPT=$(dirname "$SCRIPT")/"$link"
fi
done
if [ ! -d "${APP_DIR}" ]; then
APP_DIR=$(dirname "$SCRIPT")/..
APP_DIR=$(cd "${APP_DIR}"; pwd)
fi
executable="./modules/openapi-generator-cli/target/openapi-generator-cli.jar"
if [ ! -f "$executable" ]
then
mvn clean package
fi
# if you've executed sbt assembly previously it will use that instead.
export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties"
ags="generate -t modules/openapi-generator/src/main/resources/asciidoc-documentation --additional-properties=specDir=modules/openapi-generator/src/main/resources/asciidoc-documentation,snippetDir=. -i modules/openapi-generator/src/test/resources/3_0/petstore.yaml -g asciidoc -o samples/documentation/asciidoc $@"
java ${JAVA_OPTS} -jar ${executable} ${ags}

View File

@ -1,32 +0,0 @@
#!/usr/bin/env bash
SCRIPT="$0"
echo "# START SCRIPT: $SCRIPT"
while [ -h "$SCRIPT" ] ; do
ls=`ls -ld "$SCRIPT"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
SCRIPT="$link"
else
SCRIPT=`dirname "$SCRIPT"`/"$link"
fi
done
if [ ! -d "${APP_DIR}" ]; then
APP_DIR=`dirname "$SCRIPT"`/..
APP_DIR=`cd "${APP_DIR}"; pwd`
fi
executable="./modules/openapi-generator-cli/target/openapi-generator-cli.jar"
if [ ! -f "$executable" ]
then
mvn -B clean package
fi
# if you've executed sbt assembly previously it will use that instead.
export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties"
ags="generate -g aspnetcore -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -t modules/openapi-generator/src/main/resources/aspnetcore/3.0/ -o samples/server/petstore/aspnetcore-3.0 --additional-properties packageGuid={3C799344-F285-4669-8FD5-7ED9B795D5C5} --additional-properties aspnetCoreVersion=3.0 $@"
java $JAVA_OPTS -jar $executable $ags

View File

@ -1,32 +0,0 @@
#!/usr/bin/env bash
SCRIPT="$0"
echo "# START SCRIPT: $SCRIPT"
while [ -h "$SCRIPT" ] ; do
ls=`ls -ld "$SCRIPT"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
SCRIPT="$link"
else
SCRIPT=`dirname "$SCRIPT"`/"$link"
fi
done
if [ ! -d "${APP_DIR}" ]; then
APP_DIR=`dirname "$SCRIPT"`/..
APP_DIR=`cd "${APP_DIR}"; pwd`
fi
executable="./modules/openapi-generator-cli/target/openapi-generator-cli.jar"
if [ ! -f "$executable" ]
then
mvn -B clean package
fi
# if you've executed sbt assembly previously it will use that instead.
export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties"
ags="generate -g aspnetcore -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -t modules/openapi-generator/src/main/resources/aspnetcore/3.0/ -o samples/server/petstore/aspnetcore-3.1 --additional-properties packageGuid={3C799344-F285-4669-8FD5-7ED9B795D5C5} --additional-properties aspnetCoreVersion=3.1 $@"
java $JAVA_OPTS -jar $executable $ags

View File

@ -1,32 +0,0 @@
#!/usr/bin/env bash
SCRIPT="$0"
echo "# START SCRIPT: $SCRIPT"
while [ -h "$SCRIPT" ] ; do
ls=`ls -ld "$SCRIPT"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
SCRIPT="$link"
else
SCRIPT=`dirname "$SCRIPT"`/"$link"
fi
done
if [ ! -d "${APP_DIR}" ]; then
APP_DIR=`dirname "$SCRIPT"`/..
APP_DIR=`cd "${APP_DIR}"; pwd`
fi
executable="./modules/openapi-generator-cli/target/openapi-generator-cli.jar"
if [ ! -f "$executable" ]
then
mvn -B clean package
fi
# if you've executed sbt assembly previously it will use that instead.
export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties"
ags="generate -g aspnetcore -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -t modules/openapi-generator/src/main/resources/aspnetcore/2.1/ -o samples/server/petstore/aspnetcore --additional-properties packageGuid={3C799344-F285-4669-8FD5-7ED9B795D5C5} $@"
java $JAVA_OPTS -jar $executable $ags

View File

@ -1,32 +0,0 @@
#!/usr/bin/env bash
SCRIPT="$0"
echo "# START SCRIPT: $SCRIPT"
while [ -h "$SCRIPT" ] ; do
ls=`ls -ld "$SCRIPT"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
SCRIPT="$link"
else
SCRIPT=`dirname "$SCRIPT"`/"$link"
fi
done
if [ ! -d "${APP_DIR}" ]; then
APP_DIR=`dirname "$SCRIPT"`/..
APP_DIR=`cd "${APP_DIR}"; pwd`
fi
executable="./modules/openapi-generator-cli/target/openapi-generator-cli.jar"
if [ ! -f "$executable" ]
then
mvn -B clean package
fi
# if you've executed sbt assembly previously it will use that instead.
export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties"
ags="generate -g aspnetcore -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -t modules/openapi-generator/src/main/resources/aspnetcore/3.0/ -o samples/server/petstore/aspnetcore3 --additional-properties packageGuid={3C799344-F285-4669-8FD5-7ED9B795D5C5} --additional-properties aspnetCoreVersion=3.0 $@"
java $JAVA_OPTS -jar $executable $ags

View File

@ -1,32 +0,0 @@
#!/bin/sh
SCRIPT="$0"
echo "# START SCRIPT: $SCRIPT"
while [ -h "$SCRIPT" ] ; do
ls=`ls -ld "$SCRIPT"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
SCRIPT="$link"
else
SCRIPT=`dirname "$SCRIPT"`/"$link"
fi
done
if [ ! -d "${APP_DIR}" ]; then
APP_DIR=`dirname "$SCRIPT"`/..
APP_DIR=`cd "${APP_DIR}"; pwd`
fi
executable="./modules/openapi-generator-cli/target/openapi-generator-cli.jar"
if [ ! -f "$executable" ]
then
mvn clean package
fi
# if you've executed sbt assembly previously it will use that instead.
export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties"
ags="generate -t modules/openapi-generator/src/main/resources/avro-schema -i modules/openapi-generator/src/test/resources/3_0/petstore.yaml -g avro-schema -o samples/openapi3/schema/petstore/avro-schema $@"
java $JAVA_OPTS -jar $executable $ags

View File

@ -1,32 +0,0 @@
#!/bin/sh
SCRIPT="$0"
echo "# START SCRIPT: $SCRIPT"
while [ -h "$SCRIPT" ] ; do
ls=`ls -ld "$SCRIPT"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
SCRIPT="$link"
else
SCRIPT=`dirname "$SCRIPT"`/"$link"
fi
done
if [ ! -d "${APP_DIR}" ]; then
APP_DIR=`dirname "$SCRIPT"`/..
APP_DIR=`cd "${APP_DIR}"; pwd`
fi
executable="./modules/openapi-generator-cli/target/openapi-generator-cli.jar"
if [ ! -f "$executable" ]
then
mvn -B clean package
fi
# if you've executed sbt assembly previously it will use that instead.
export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties"
args="generate -t modules/openapi-generator/src/main/resources/bash -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g bash -o samples/client/petstore/bash -c modules/openapi-generator/src/test/resources/2_0/bash-config.json --additional-properties hideGenerationTimestamp=true $@"
java $JAVA_OPTS -jar $executable $args

View File

@ -1,32 +0,0 @@
#!/bin/sh
SCRIPT="$0"
echo "# START SCRIPT: $SCRIPT"
while [ -h "$SCRIPT" ] ; do
ls=`ls -ld "$SCRIPT"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
SCRIPT="$link"
else
SCRIPT=`dirname "$SCRIPT"`/"$link"
fi
done
if [ ! -d "${APP_DIR}" ]; then
APP_DIR=`dirname "$SCRIPT"`/..
APP_DIR=`cd "${APP_DIR}"; pwd`
fi
executable="./modules/openapi-generator-cli/target/openapi-generator-cli.jar"
if [ ! -f "$executable" ]
then
mvn -B clean package
fi
# if you've executed sbt assembly previously it will use that instead.
export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties"
ags="generate -t modules/openapi-generator/src/main/resources/C-libcurl -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g c -o samples/client/petstore/c $@"
java $JAVA_OPTS -jar $executable $ags

View File

@ -1,6 +0,0 @@
{
"generatorName": "apex",
"inputSpec": "modules/openapi-generator/src/test/resources/2_0/petstore.yaml",
"outputDir": "samples/client/petstore/apex",
"templateDir": "modules/openapi-generator/src/main/resources/apex"
}

View File

@ -1,11 +0,0 @@
{
"generatorName": "csharp-netcore",
"inputSpec": "modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml",
"outputDir": "samples/client/petstore/csharp-netcore/OpenAPIClientCore",
"templateDir": "modules/openapi-generator/src/main/resources/csharp-netcore/",
"additionalProperties": {
"packageGuid": "{321C8C3F-0156-40C1-AE42-D59761FB9B6C}",
"useCompareNetObjects": true,
"targetFramework": "netcoreapp2.0"
}
}

View File

@ -1,10 +0,0 @@
{
"generatorName": "csharp-netcore",
"inputSpec": "modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml",
"outputDir": "samples/client/petstore/csharp-netcore/OpenAPIClient",
"templateDir": "modules/openapi-generator/src/main/resources/csharp-netcore/",
"additionalProperties": {
"packageGuid": "{321C8C3F-0156-40C1-AE42-D59761FB9B6C}",
"useCompareNetObjects": true
}
}

View File

@ -1,8 +0,0 @@
{
"generatorName": "csharp",
"inputSpec": "modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml",
"outputDir": "samples/client/petstore/csharp/OpenAPIClient",
"additionalProperties": {
"packageGuid": "{321C8C3F-0156-40C1-AE42-D59761FB9B6C}"
}
}

View File

@ -1,11 +0,0 @@
{
"generatorName": "dart",
"inputSpec": "modules/openapi-generator/src/test/resources/2_0/petstore.yaml",
"outputDir": "samples/client/petstore/dart/flutter_petstore/openapi",
"templateDir": "modules/openapi-generator/src/main/resources/dart",
"additionalProperties": {
"hideGenerationTimestamp": true,
"browserClient": false,
"supportDart2": false
}
}

View File

@ -1,10 +0,0 @@
{
"generatorName": "dart-jaguar",
"inputSpec": "modules/openapi-generator/src/test/resources/2_0/petstore.yaml",
"outputDir": "samples/client/petstore/dart-jaguar/flutter_petstore/openapi",
"templateDir": "modules/openapi-generator/src/main/resources/dart-jaguar",
"additionalProperties": {
"hideGenerationTimestamp": true,
"pubName": "openapi"
}
}

View File

@ -1,11 +0,0 @@
{
"generatorName": "dart-jaguar",
"inputSpec": "modules/openapi-generator/src/test/resources/2_0/petstore-proto.yaml",
"outputDir": "samples/client/petstore/dart-jaguar/flutter_proto_petstore/openapi",
"templateDir": "modules/openapi-generator/src/main/resources/dart-jaguar",
"additionalProperties": {
"serialization": "proto",
"hideGenerationTimestamp": true,
"pubName": "openapi"
}
}

View File

@ -1,11 +0,0 @@
{
"generatorName": "dart-jaguar",
"inputSpec": "modules/openapi-generator/src/test/resources/2_0/petstore-proto.yaml",
"outputDir": "samples/client/petstore/dart-jaguar/openapi_proto",
"templateDir": "modules/openapi-generator/src/main/resources/dart-jaguar",
"additionalProperties": {
"serialization": "proto",
"hideGenerationTimestamp": true,
"pubName": "openapi"
}
}

View File

@ -1,10 +0,0 @@
{
"generatorName": "dart-jaguar",
"inputSpec": "modules/openapi-generator/src/test/resources/2_0/petstore.yaml",
"outputDir": "samples/client/petstore/dart-jaguar/openapi",
"templateDir": "modules/openapi-generator/src/main/resources/dart-jaguar",
"additionalProperties": {
"hideGenerationTimestamp": true,
"pubName": "openapi"
}
}

View File

@ -1,11 +0,0 @@
{
"generatorName": "dart",
"inputSpec": "modules/openapi-generator/src/test/resources/2_0/petstore.yaml",
"outputDir": "samples/client/petstore/dart/flutter_petstore/openapi",
"templateDir": "modules/openapi-generator/src/main/resources/dart",
"additionalProperties": {
"hideGenerationTimestamp": true,
"browserClient": false,
"supportDart2": false
}
}

View File

@ -1,11 +0,0 @@
{
"generatorName": "dart",
"inputSpec": "modules/openapi-generator/src/test/resources/2_0/petstore.yaml",
"outputDir": "samples/client/petstore/dart/openapi-browser-client",
"templateDir": "modules/openapi-generator/src/main/resources/dart",
"additionalProperties": {
"hideGenerationTimestamp": true,
"browserClient": true,
"supportDart2": false
}
}

View File

@ -1,11 +0,0 @@
{
"generatorName": "dart",
"inputSpec": "modules/openapi-generator/src/test/resources/2_0/petstore.yaml",
"outputDir": "samples/client/petstore/dart/openapi",
"templateDir": "modules/openapi-generator/src/main/resources/dart",
"additionalProperties": {
"hideGenerationTimestamp": true,
"browserClient": false,
"supportDart2": false
}
}

View File

@ -1,9 +0,0 @@
{
"generatorName": "dart",
"inputSpec": "modules/openapi-generator/src/test/resources/2_0/petstore.yaml",
"outputDir": "samples/client/petstore/dart2/openapi",
"templateDir": "modules/openapi-generator/src/main/resources/dart2",
"additionalProperties": {
"hideGenerationTimestamp": true
}
}

View File

@ -1,9 +0,0 @@
{
"generatorName": "elixir",
"inputSpec": "modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml",
"outputDir": "samples/client/petstore/elixir/",
"templateDir": "modules/openapi-generator/src/main/resources/elixir",
"additionalProperties": {
"invokerPackage": "OpenapiPetstore"
}
}

View File

@ -1,10 +0,0 @@
{
"generatorName": "go-gin-server",
"inputSpec": "modules/openapi-generator/src/test/resources/2_0/petstore.yaml",
"outputDir": "samples/server/petstore/go-gin-api-server",
"templateDir": "modules/openapi-generator/src/main/resources/go-gin-server",
"additionalProperties": {
"packageName": "petstoreserver",
"hideGenerationTimestamp": true
}
}

View File

@ -1,11 +0,0 @@
{
"generatorName": "go",
"inputSpec": "modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml",
"outputDir": "samples/client/petstore/go/go-petstore-withXml",
"templateDir": "modules/openapi-generator/src/main/resources/go",
"additionalProperties": {
"packageName": "petstore",
"withXml": true,
"withGoCodegenComment": true
}
}

View File

@ -1,9 +0,0 @@
{
"generatorName": "go",
"inputSpec": "modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml",
"outputDir": "samples/client/petstore/go/go-petstore",
"templateDir": "modules/openapi-generator/src/main/resources/go",
"additionalProperties": {
"packageName": "petstore"
}
}

View File

@ -1,9 +0,0 @@
{
"generatorName": "groovy",
"inputSpec": "modules/openapi-generator/src/test/resources/2_0/petstore.yaml",
"outputDir": "samples/client/petstore/groovy",
"templateDir": "modules/openapi-generator/src/main/resources/Groovy/",
"additionalProperties": {
"hideGenerationTimestamp": true
}
}

View File

@ -1,6 +0,0 @@
{
"generatorName": "haskell-http-client",
"inputSpec": "modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml",
"outputDir": "samples/client/petstore/haskell-http-client",
"templateDir": "modules/openapi-generator/src/main/resources/haskell-http-client"
}

View File

@ -1,12 +0,0 @@
{
"!include": "bin/java-petstore-feign-9x.json",
"generatorName": "java",
"inputSpec": "modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml",
"outputDir": "samples/client/petstore/java/feign",
"templateDir": "modules/openapi-generator/src/main/resources/Java/libraries/feign",
"additionalProperties": {
"hideGenerationTimestamp": true,
"booleanGetterPrefix": "is",
"additionalModelTypeAnnotations": "@javax.annotation.concurrent.Immutable"
}
}

View File

@ -1,11 +0,0 @@
{
"!include": "bin/java-petstore-feign-10x.json",
"generatorName": "java",
"inputSpec": "modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml",
"outputDir": "samples/client/petstore/java/feign10x",
"templateDir": "modules/openapi-generator/src/main/resources/Java/libraries/feign",
"additionalProperties": {
"hideGenerationTimestamp": true,
"booleanGetterPrefix": "is"
}
}

View File

@ -1,10 +0,0 @@
{
"!include": "bin/java-petstore-google-api-client.json",
"generatorName": "java",
"inputSpec": "modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml",
"outputDir": "samples/client/petstore/java/google-api-client",
"templateDir": "modules/openapi-generator/src/main/resources/Java/libraries/google-api-client",
"additionalProperties": {
"hideGenerationTimestamp": true
}
}

View File

@ -1,12 +0,0 @@
{
"artifactId": "cxf-annotated-basepath",
"generatorName": "jaxrs-cxf",
"inputSpec": "modules/openapi-generator/src/test/resources/2_0/petstore.yaml",
"outputDir": "samples/server/petstore/jaxrs-cxf-annotated-base-path",
"templateDir": "modules/openapi-generator/src/main/resources/JavaJaxRS/cxf",
"additionalProperties": {
"hideGenerationTimestamp": true,
"useAnnotatedBasePath": true,
"serverPort": "8082"
}
}

View File

@ -1,9 +0,0 @@
{
"generatorName": "jaxrs-cxf-cdi",
"inputSpec": "modules/openapi-generator/src/test/resources/2_0/petstore.yaml",
"outputDir": "samples/server/petstore/jaxrs-cxf-cdi",
"templateDir": "modules/openapi-generator/src/main/resources/JavaJaxRS/cxf-cdi",
"additionalProperties": {
"hideGenerationTimestamp": true
}
}

View File

@ -1,12 +0,0 @@
{
"artifactId": "cxf-server-non-spring",
"generatorName": "jaxrs-cxf",
"inputSpec": "modules/openapi-generator/src/test/resources/2_0/petstore.yaml",
"outputDir": "samples/server/petstore/jaxrs-cxf-non-spring-app",
"templateDir": "modules/openapi-generator/src/main/resources/JavaJaxRS/cxf",
"additionalProperties": {
"hideGenerationTimestamp": true,
"generateNonSpringApplication": true,
"serverPort": "8082"
}
}

View File

@ -1,10 +0,0 @@
{
"generatorName": "jaxrs-cxf",
"inputSpec": "modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml",
"outputDir": "samples/server/petstore/jaxrs-cxf",
"templateDir": "modules/openapi-generator/src/main/resources/JavaJaxRS/cxf",
"additionalProperties": {
"hideGenerationTimestamp": true,
"serverPort": "8082"
}
}

View File

@ -1,11 +0,0 @@
{
"!include": "bin/jaxrs-datelib-j8.json",
"generatorName": "jaxrs-jersey",
"inputSpec": "modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml",
"outputDir": "samples/server/petstore/jaxrs-datelib-j8/",
"templateDir": "modules/openapi-generator/src/main/resources/JavaJaxRS/",
"additionalProperties": {
"hideGenerationTimestamp": true,
"serverPort": "8082"
}
}

View File

@ -1,10 +0,0 @@
{
"artifactId": "openapiv3-jaxrs-jersey-petstore-server",
"generatorName": "jaxrs-jersey",
"inputSpec": "modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing.yaml",
"outputDir": "samples/server/petstore/jaxrs-jersey",
"templateDir": "modules/openapi-generator/src/main/resources/JavaJaxRS/",
"additionalProperties": {
"hideGenerationTimestamp": true
}
}

View File

@ -1,13 +0,0 @@
{
"artifactId": "jaxrs-jersey1-useTags",
"generatorName": "jaxrs-jersey",
"inputSpec": "modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml",
"library": "jersey1",
"outputDir": "samples/server/petstore/jaxrs/jersey1-useTags",
"templateDir": "modules/openapi-generator/src/main/resources/JavaJaxRS",
"additionalProperties": {
"hideGenerationTimestamp": true,
"serverPort": "8082",
"useTags": true
}
}

View File

@ -1,12 +0,0 @@
{
"artifactId": "jaxrs-jersey1-server",
"generatorName": "jaxrs-jersey",
"inputSpec": "modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml",
"library": "jersey1",
"outputDir": "samples/server/petstore/jaxrs/jersey1",
"templateDir": "modules/openapi-generator/src/main/resources/JavaJaxRS",
"additionalProperties": {
"hideGenerationTimestamp": true,
"serverPort": "8082"
}
}

Some files were not shown because too many files have changed in this diff Show More