mirror of
https://github.com/valitydev/openapi-generator.git
synced 2024-11-07 10:58:55 +00:00
Refine CXF Add Spring Annotation-Config + Jboss flag for CXF/Resteasy + fix OuterEnum (#4164)
* add json annotations * add cli flag to check for jaxb annotations * add CLI-flag for switching Spring-XML or annotation config #4088 * add cli flag for generating jboss depl. descriptor #4088 * add JbossFeature CLI flag to Resteasy #4088 * update/add tests #4088 * cleanup tabs #4088 * improve api formatting #4088 * refine formatting #4088 * refine formatting again #4088 * add separate CLI-flags for controlling junit test features #4088 * add json annotations * add cli flag to check for jaxb annotations * add CLI-flag for switching Spring-XML or annotation config #4088 * add cli flag for generating jboss depl. descriptor #4088 * add JbossFeature CLI flag to Resteasy #4088 * update/add tests #4088 * cleanup tabs #4088 * improve api formatting #4088 * refine formatting #4088 * refine formatting again #4088 * add separate CLI-flags for controlling junit test features #4088 * add check for void methods + assertNotNull(response) #4088 * add spaces for @Produces #4088 * allow build with no web.xml config #4088 * comment invocations of tests #4088 * update petstore sample jaxrs-cxf server with gen/java first #4088 * re-generate jaxrs-cxf with src/gen/java #4088 * add client jaxrs-cxf #4088 * add switch to load SwaggerUI automatically #4088 * update to CXF 3.1.8 including supportSwaggerUi flag #4088 * update to cxf 3.1.8 and swagger-core 1.5.10 #4088 * update generated petstore for jaxrs-cxf #4088 * change Spring Boot urls to root #4088 * fix spring xml config #4088 * fix external enum usage for jaxrs-cxf #4160 * cleanup jaxrs-annotations in impl class * fix handling of multiparts #4088 * fix @Min/@Max comments in beanValidationQueryParams #4088 * add swagger-codegen-ignore file+add src/test/resources #4088 * add cli-flag for produces/consumes json in api #4088 * add test case for outerEnum #4160
This commit is contained in:
parent
95ac238026
commit
b02d505ad9
@ -17,6 +17,7 @@ public abstract class AbstractJavaJAXRSServerCodegen extends AbstractJavaCodegen
|
||||
*/
|
||||
protected static final String JAXRS_TEMPLATE_DIRECTORY_NAME = "JavaJaxRS";
|
||||
protected String implFolder = "src/main/java";
|
||||
protected String testResourcesFolder = "src/test/resources";
|
||||
protected String title = "Swagger Server";
|
||||
static Logger LOGGER = LoggerFactory.getLogger(AbstractJavaJAXRSServerCodegen.class);
|
||||
|
||||
|
@ -14,11 +14,14 @@ import io.swagger.codegen.CodegenOperation;
|
||||
import io.swagger.codegen.CodegenProperty;
|
||||
import io.swagger.codegen.CodegenType;
|
||||
import io.swagger.codegen.SupportingFile;
|
||||
import io.swagger.codegen.languages.features.CXFFeatures;
|
||||
import io.swagger.codegen.languages.features.LoggingFeatures;
|
||||
import io.swagger.codegen.languages.features.BeanValidationFeatures;
|
||||
import io.swagger.codegen.languages.features.GzipTestFeatures;
|
||||
import io.swagger.codegen.languages.features.JaxbFeatures;
|
||||
import io.swagger.codegen.languages.features.LoggingTestFeatures;
|
||||
import io.swagger.models.Operation;
|
||||
|
||||
public class JavaCXFClientCodegen extends AbstractJavaCodegen implements CXFFeatures
|
||||
public class JavaCXFClientCodegen extends AbstractJavaCodegen
|
||||
implements BeanValidationFeatures, JaxbFeatures, GzipTestFeatures, LoggingTestFeatures
|
||||
{
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(JavaCXFClientCodegen.class);
|
||||
|
||||
@ -28,14 +31,13 @@ public class JavaCXFClientCodegen extends AbstractJavaCodegen implements CXFFeat
|
||||
*/
|
||||
protected static final String JAXRS_TEMPLATE_DIRECTORY_NAME = "JavaJaxRS";
|
||||
|
||||
protected boolean useJaxbAnnotations = true;
|
||||
|
||||
protected boolean useBeanValidation = false;
|
||||
|
||||
protected boolean useGzipFeature = false;
|
||||
|
||||
protected boolean useLoggingFeature = false;
|
||||
|
||||
protected boolean useBeanValidationFeature = false;
|
||||
protected boolean useGzipFeatureForTests = false;
|
||||
|
||||
protected boolean useLoggingFeatureForTests = false;
|
||||
|
||||
public JavaCXFClientCodegen()
|
||||
{
|
||||
@ -67,11 +69,12 @@ public class JavaCXFClientCodegen extends AbstractJavaCodegen implements CXFFeat
|
||||
|
||||
embeddedTemplateDir = templateDir = JAXRS_TEMPLATE_DIRECTORY_NAME + File.separator + "cxf";
|
||||
|
||||
cliOptions.add(CliOption.newBoolean(USE_JAXB_ANNOTATIONS, "Use JAXB annotations for XML"));
|
||||
|
||||
cliOptions.add(CliOption.newBoolean(USE_BEANVALIDATION, "Use BeanValidation API annotations"));
|
||||
|
||||
cliOptions.add(CliOption.newBoolean(USE_GZIP_FEATURE, "Use Gzip Feature"));
|
||||
cliOptions.add(CliOption.newBoolean(USE_BEANVALIDATION_FEATURE, "Use BeanValidation Feature"));
|
||||
cliOptions.add(CliOption.newBoolean(USE_LOGGING_FEATURE, "Use Logging Feature"));
|
||||
cliOptions.add(CliOption.newBoolean(USE_GZIP_FEATURE_FOR_TESTS, "Use Gzip Feature for tests"));
|
||||
cliOptions.add(CliOption.newBoolean(USE_LOGGING_FEATURE_FOR_TESTS, "Use Logging Feature for tests"));
|
||||
|
||||
|
||||
}
|
||||
@ -82,19 +85,19 @@ public class JavaCXFClientCodegen extends AbstractJavaCodegen implements CXFFeat
|
||||
{
|
||||
super.processOpts();
|
||||
|
||||
if (additionalProperties.containsKey(USE_JAXB_ANNOTATIONS)) {
|
||||
boolean useJaxbAnnotationsProp = convertPropertyToBooleanAndWriteBack(USE_JAXB_ANNOTATIONS);
|
||||
this.setUseJaxbAnnotations(useJaxbAnnotationsProp);
|
||||
}
|
||||
|
||||
if (additionalProperties.containsKey(USE_BEANVALIDATION)) {
|
||||
boolean useBeanValidationProp = convertPropertyToBooleanAndWriteBack(USE_BEANVALIDATION);
|
||||
this.setUseBeanValidation(useBeanValidationProp);
|
||||
}
|
||||
|
||||
this.setUseGzipFeature(convertPropertyToBooleanAndWriteBack(USE_GZIP_FEATURE));
|
||||
this.setUseLoggingFeature(convertPropertyToBooleanAndWriteBack(USE_LOGGING_FEATURE));
|
||||
this.setUseGzipFeatureForTests(convertPropertyToBooleanAndWriteBack(USE_GZIP_FEATURE_FOR_TESTS));
|
||||
this.setUseLoggingFeatureForTests(convertPropertyToBooleanAndWriteBack(USE_LOGGING_FEATURE_FOR_TESTS));
|
||||
|
||||
boolean useBeanValidationFeature = convertPropertyToBooleanAndWriteBack(USE_BEANVALIDATION_FEATURE);
|
||||
this.setUseBeanValidationFeature(useBeanValidationFeature);
|
||||
if (useBeanValidationFeature) {
|
||||
LOGGER.info("make sure your client supports Bean Validation 1.1");
|
||||
}
|
||||
|
||||
supportingFiles.clear(); // Don't need extra files provided by AbstractJAX-RS & Java Codegen
|
||||
|
||||
@ -141,18 +144,16 @@ public class JavaCXFClientCodegen extends AbstractJavaCodegen implements CXFFeat
|
||||
}
|
||||
|
||||
|
||||
public void setUseGzipFeature(boolean useGzipFeature) {
|
||||
this.useGzipFeature = useGzipFeature;
|
||||
public void setUseJaxbAnnotations(boolean useJaxbAnnotations) {
|
||||
this.useJaxbAnnotations = useJaxbAnnotations;
|
||||
}
|
||||
|
||||
|
||||
public void setUseLoggingFeature(boolean useLoggingFeature) {
|
||||
this.useLoggingFeature = useLoggingFeature;
|
||||
public void setUseGzipFeatureForTests(boolean useGzipFeatureForTests) {
|
||||
this.useGzipFeatureForTests = useGzipFeatureForTests;
|
||||
}
|
||||
|
||||
|
||||
public void setUseBeanValidationFeature(boolean useBeanValidationFeature) {
|
||||
this.useBeanValidationFeature = useBeanValidationFeature;
|
||||
public void setUseLoggingFeatureForTests(boolean useLoggingFeatureForTests) {
|
||||
this.useLoggingFeatureForTests = useLoggingFeatureForTests;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -14,30 +14,48 @@ import io.swagger.codegen.CodegenOperation;
|
||||
import io.swagger.codegen.CodegenProperty;
|
||||
import io.swagger.codegen.SupportingFile;
|
||||
import io.swagger.codegen.languages.features.CXFServerFeatures;
|
||||
import io.swagger.codegen.languages.features.GzipTestFeatures;
|
||||
import io.swagger.codegen.languages.features.JaxbFeatures;
|
||||
import io.swagger.codegen.languages.features.LoggingTestFeatures;
|
||||
import io.swagger.models.Operation;
|
||||
|
||||
public class JavaCXFServerCodegen extends AbstractJavaJAXRSServerCodegen implements CXFServerFeatures
|
||||
public class JavaCXFServerCodegen extends AbstractJavaJAXRSServerCodegen
|
||||
implements CXFServerFeatures, GzipTestFeatures, LoggingTestFeatures, JaxbFeatures
|
||||
{
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(JavaCXFServerCodegen.class);
|
||||
|
||||
protected boolean addConsumesProducesJson = true;
|
||||
|
||||
protected boolean useJaxbAnnotations = true;
|
||||
|
||||
protected boolean useBeanValidation = false;
|
||||
|
||||
protected boolean generateSpringApplication = false;
|
||||
|
||||
protected boolean useSpringAnnotationConfig = false;
|
||||
|
||||
protected boolean useSwaggerFeature = false;
|
||||
|
||||
protected boolean useSwaggerUI = false;
|
||||
|
||||
protected boolean useWadlFeature = false;
|
||||
|
||||
protected boolean useMultipartFeature = false;
|
||||
|
||||
protected boolean useGzipFeature = false;
|
||||
|
||||
protected boolean useLoggingFeature = false;
|
||||
|
||||
protected boolean useBeanValidationFeature = false;
|
||||
|
||||
protected boolean generateSpringBootApplication= false;
|
||||
|
||||
protected boolean generateJbossDeploymentDescriptor = false;
|
||||
|
||||
protected boolean useGzipFeature = false;
|
||||
|
||||
protected boolean useGzipFeatureForTests = false;
|
||||
|
||||
protected boolean useLoggingFeature = false;
|
||||
|
||||
protected boolean useLoggingFeatureForTests = false;
|
||||
|
||||
public JavaCXFServerCodegen()
|
||||
{
|
||||
super();
|
||||
@ -64,18 +82,31 @@ public class JavaCXFServerCodegen extends AbstractJavaJAXRSServerCodegen impleme
|
||||
|
||||
embeddedTemplateDir = templateDir = JAXRS_TEMPLATE_DIRECTORY_NAME + File.separator + "cxf";
|
||||
|
||||
cliOptions.add(CliOption.newBoolean(USE_JAXB_ANNOTATIONS, "Use JAXB annotations for XML"));
|
||||
|
||||
cliOptions.add(CliOption.newBoolean(USE_BEANVALIDATION, "Use BeanValidation API annotations"));
|
||||
cliOptions.add(CliOption.newBoolean(GENERATE_SPRING_APPLICATION, "Generate Spring application"));
|
||||
cliOptions.add(CliOption.newBoolean(USE_SPRING_ANNOTATION_CONFIG, "Use Spring Annotation Config"));
|
||||
|
||||
cliOptions.add(CliOption.newBoolean(USE_SWAGGER_FEATURE, "Use Swagger Feature"));
|
||||
cliOptions.add(CliOption.newBoolean(USE_SWAGGER_UI, "Use Swagger UI"));
|
||||
|
||||
cliOptions.add(CliOption.newBoolean(USE_WADL_FEATURE, "Use WADL Feature"));
|
||||
cliOptions.add(CliOption.newBoolean(USE_MULTIPART_FEATURE, "Use Multipart Feature"));
|
||||
|
||||
cliOptions.add(CliOption.newBoolean(USE_GZIP_FEATURE, "Use Gzip Feature"));
|
||||
cliOptions.add(CliOption.newBoolean(USE_GZIP_FEATURE_FOR_TESTS, "Use Gzip Feature for tests"));
|
||||
|
||||
cliOptions.add(CliOption.newBoolean(USE_BEANVALIDATION_FEATURE, "Use BeanValidation Feature"));
|
||||
cliOptions.add(CliOption.newBoolean(USE_LOGGING_FEATURE, "Use Logging Feature"));
|
||||
cliOptions.add(CliOption.newBoolean(USE_LOGGING_FEATURE_FOR_TESTS, "Use Logging Feature for tests"));
|
||||
|
||||
cliOptions.add(CliOption.newBoolean(GENERATE_SPRING_BOOT_APPLICATION, "Generate Spring Boot application"));
|
||||
cliOptions.add(
|
||||
CliOption.newBoolean(GENERATE_JBOSS_DEPLOYMENT_DESCRIPTOR, "Generate Jboss Deployment Descriptor"));
|
||||
|
||||
cliOptions
|
||||
.add(CliOption.newBoolean(ADD_CONSUMES_PRODUCES_JSON, "Add @Consumes/@Produces Json to API interface"));
|
||||
|
||||
}
|
||||
|
||||
@ -85,19 +116,33 @@ public class JavaCXFServerCodegen extends AbstractJavaJAXRSServerCodegen impleme
|
||||
{
|
||||
super.processOpts();
|
||||
|
||||
if (additionalProperties.containsKey(USE_JAXB_ANNOTATIONS)) {
|
||||
boolean useJaxbAnnotationsProp = convertPropertyToBooleanAndWriteBack(USE_JAXB_ANNOTATIONS);
|
||||
this.setUseJaxbAnnotations(useJaxbAnnotationsProp);
|
||||
}
|
||||
|
||||
if (additionalProperties.containsKey(USE_BEANVALIDATION)) {
|
||||
boolean useBeanValidationProp = convertPropertyToBooleanAndWriteBack(USE_BEANVALIDATION);
|
||||
this.setUseBeanValidation(useBeanValidationProp);
|
||||
}
|
||||
|
||||
if (additionalProperties.containsKey(ADD_CONSUMES_PRODUCES_JSON)) {
|
||||
this.setAddConsumesProducesJson(convertPropertyToBooleanAndWriteBack(ADD_CONSUMES_PRODUCES_JSON));
|
||||
}
|
||||
|
||||
if (additionalProperties.containsKey(GENERATE_SPRING_APPLICATION)) {
|
||||
this.setGenerateSpringApplication(convertPropertyToBooleanAndWriteBack(GENERATE_SPRING_APPLICATION));
|
||||
|
||||
this.setUseSwaggerFeature(convertPropertyToBooleanAndWriteBack(USE_SWAGGER_FEATURE));
|
||||
this.setUseSwaggerUI(convertPropertyToBooleanAndWriteBack(USE_SWAGGER_UI));
|
||||
|
||||
this.setUseWadlFeature(convertPropertyToBooleanAndWriteBack(USE_WADL_FEATURE));
|
||||
this.setUseMultipartFeature(convertPropertyToBooleanAndWriteBack(USE_MULTIPART_FEATURE));
|
||||
this.setUseGzipFeature(convertPropertyToBooleanAndWriteBack(USE_GZIP_FEATURE));
|
||||
this.setUseGzipFeatureForTests(convertPropertyToBooleanAndWriteBack(USE_GZIP_FEATURE_FOR_TESTS));
|
||||
this.setUseLoggingFeature(convertPropertyToBooleanAndWriteBack(USE_LOGGING_FEATURE));
|
||||
this.setUseLoggingFeatureForTests(convertPropertyToBooleanAndWriteBack(USE_LOGGING_FEATURE_FOR_TESTS));
|
||||
this.setUseSpringAnnotationConfig(convertPropertyToBooleanAndWriteBack(USE_SPRING_ANNOTATION_CONFIG));
|
||||
|
||||
boolean useBeanValidationFeature = convertPropertyToBooleanAndWriteBack(USE_BEANVALIDATION_FEATURE);
|
||||
this.setUseBeanValidationFeature(useBeanValidationFeature);
|
||||
@ -107,12 +152,20 @@ public class JavaCXFServerCodegen extends AbstractJavaJAXRSServerCodegen impleme
|
||||
|
||||
this.setGenerateSpringBootApplication(convertPropertyToBooleanAndWriteBack(GENERATE_SPRING_BOOT_APPLICATION));
|
||||
}
|
||||
|
||||
|
||||
if (additionalProperties.containsKey(GENERATE_JBOSS_DEPLOYMENT_DESCRIPTOR)) {
|
||||
boolean generateJbossDeploymentDescriptorProp = convertPropertyToBooleanAndWriteBack(
|
||||
GENERATE_JBOSS_DEPLOYMENT_DESCRIPTOR);
|
||||
this.setGenerateJbossDeploymentDescriptor(generateJbossDeploymentDescriptorProp);
|
||||
}
|
||||
|
||||
supportingFiles.clear(); // Don't need extra files provided by AbstractJAX-RS & Java Codegen
|
||||
|
||||
writeOptional(outputFolder, new SupportingFile("server/pom.mustache", "", "pom.xml"));
|
||||
|
||||
writeOptional(outputFolder,
|
||||
new SupportingFile("server/swagger-codegen-ignore.mustache", "", ".swagger-codegen-ignore"));
|
||||
|
||||
if (this.generateSpringApplication) {
|
||||
writeOptional(outputFolder, new SupportingFile("server/readme.md", "", "readme.md"));
|
||||
|
||||
@ -124,14 +177,19 @@ public class JavaCXFServerCodegen extends AbstractJavaJAXRSServerCodegen impleme
|
||||
("src/main/webapp/WEB-INF"), "context.xml"));
|
||||
|
||||
// Jboss
|
||||
writeOptional(outputFolder, new SupportingFile("server/jboss-web.xml.mustache",
|
||||
("src/main/webapp/WEB-INF"), "jboss-web.xml"));
|
||||
if (generateJbossDeploymentDescriptor) {
|
||||
writeOptional(outputFolder, new SupportingFile("server/jboss-web.xml.mustache",
|
||||
("src/main/webapp/WEB-INF"), "jboss-web.xml"));
|
||||
|
||||
}
|
||||
|
||||
// Spring Boot
|
||||
if (this.generateSpringBootApplication) {
|
||||
writeOptional(outputFolder, new SupportingFile("server/SpringBootApplication.mustache",
|
||||
(testFolder + '/' + apiPackage).replace(".", "/"), "SpringBootApplication.java"));
|
||||
|
||||
writeOptional(outputFolder, new SupportingFile("server/application.properties.mustache",
|
||||
(testResourcesFolder + '/'), "application.properties"));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@ -174,6 +232,9 @@ public class JavaCXFServerCodegen extends AbstractJavaJAXRSServerCodegen impleme
|
||||
this.generateSpringApplication = generateSpringApplication;
|
||||
}
|
||||
|
||||
public void setUseSpringAnnotationConfig(boolean useSpringAnnotationConfig) {
|
||||
this.useSpringAnnotationConfig = useSpringAnnotationConfig;
|
||||
}
|
||||
|
||||
public void setUseSwaggerFeature(boolean useSwaggerFeature) {
|
||||
this.useSwaggerFeature = useSwaggerFeature;
|
||||
@ -204,7 +265,32 @@ public class JavaCXFServerCodegen extends AbstractJavaJAXRSServerCodegen impleme
|
||||
this.useBeanValidationFeature = useBeanValidationFeature;
|
||||
}
|
||||
|
||||
public void setGenerateSpringBootApplication(boolean generateSpringBootApplication) {
|
||||
public void setGenerateSpringBootApplication(boolean generateSpringBootApplication) {
|
||||
this.generateSpringBootApplication = generateSpringBootApplication;
|
||||
}
|
||||
|
||||
public void setUseJaxbAnnotations(boolean useJaxbAnnotations) {
|
||||
this.useJaxbAnnotations = useJaxbAnnotations;
|
||||
}
|
||||
|
||||
public void setGenerateJbossDeploymentDescriptor(boolean generateJbossDeploymentDescriptor) {
|
||||
this.generateJbossDeploymentDescriptor = generateJbossDeploymentDescriptor;
|
||||
}
|
||||
|
||||
public void setUseGzipFeatureForTests(boolean useGzipFeatureForTests) {
|
||||
this.useGzipFeatureForTests = useGzipFeatureForTests;
|
||||
}
|
||||
|
||||
public void setUseLoggingFeatureForTests(boolean useLoggingFeatureForTests) {
|
||||
this.useLoggingFeatureForTests = useLoggingFeatureForTests;
|
||||
}
|
||||
|
||||
public void setUseSwaggerUI(boolean useSwaggerUI) {
|
||||
this.useSwaggerUI = useSwaggerUI;
|
||||
}
|
||||
|
||||
public void setAddConsumesProducesJson(boolean addConsumesProducesJson) {
|
||||
this.addConsumesProducesJson = addConsumesProducesJson;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
package io.swagger.codegen.languages;
|
||||
|
||||
import io.swagger.codegen.*;
|
||||
import io.swagger.codegen.languages.features.JbossFeature;
|
||||
import io.swagger.models.Operation;
|
||||
import org.apache.commons.lang3.BooleanUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
@ -8,7 +9,9 @@ import org.apache.commons.lang3.StringUtils;
|
||||
import java.io.File;
|
||||
import java.util.*;
|
||||
|
||||
public class JavaResteasyServerCodegen extends AbstractJavaJAXRSServerCodegen {
|
||||
public class JavaResteasyServerCodegen extends AbstractJavaJAXRSServerCodegen implements JbossFeature {
|
||||
|
||||
protected boolean generateJbossDeploymentDescriptor = true;
|
||||
|
||||
public JavaResteasyServerCodegen() {
|
||||
|
||||
@ -31,6 +34,9 @@ public class JavaResteasyServerCodegen extends AbstractJavaJAXRSServerCodegen {
|
||||
dateLibrary = "legacy";// TODO: change to joda
|
||||
|
||||
embeddedTemplateDir = templateDir = "JavaJaxRS" + File.separator + "resteasy";
|
||||
|
||||
cliOptions.add(
|
||||
CliOption.newBoolean(GENERATE_JBOSS_DEPLOYMENT_DESCRIPTOR, "Generate Jboss Deployment Descriptor"));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -47,6 +53,12 @@ public class JavaResteasyServerCodegen extends AbstractJavaJAXRSServerCodegen {
|
||||
public void processOpts() {
|
||||
super.processOpts();
|
||||
|
||||
if (additionalProperties.containsKey(GENERATE_JBOSS_DEPLOYMENT_DESCRIPTOR)) {
|
||||
boolean generateJbossDeploymentDescriptorProp = convertPropertyToBooleanAndWriteBack(
|
||||
GENERATE_JBOSS_DEPLOYMENT_DESCRIPTOR);
|
||||
this.setGenerateJbossDeploymentDescriptor(generateJbossDeploymentDescriptorProp);
|
||||
}
|
||||
|
||||
writeOptional(outputFolder, new SupportingFile("pom.mustache", "", "pom.xml"));
|
||||
writeOptional(outputFolder, new SupportingFile("gradle.mustache", "", "build.gradle"));
|
||||
writeOptional(outputFolder, new SupportingFile("settingsGradle.mustache", "", "settings.gradle"));
|
||||
@ -61,8 +73,12 @@ public class JavaResteasyServerCodegen extends AbstractJavaJAXRSServerCodegen {
|
||||
(sourceFolder + '/' + apiPackage).replace(".", "/"), "NotFoundException.java"));
|
||||
writeOptional(outputFolder, new SupportingFile("web.mustache",
|
||||
("src/main/webapp/WEB-INF"), "web.xml"));
|
||||
writeOptional(outputFolder, new SupportingFile("jboss-web.mustache",
|
||||
|
||||
if (generateJbossDeploymentDescriptor) {
|
||||
writeOptional(outputFolder, new SupportingFile("jboss-web.mustache",
|
||||
("src/main/webapp/WEB-INF"), "jboss-web.xml"));
|
||||
}
|
||||
|
||||
writeOptional(outputFolder, new SupportingFile("RestApplication.mustache",
|
||||
(sourceFolder + '/' + invokerPackage).replace(".", "/"), "RestApplication.java"));
|
||||
supportingFiles.add(new SupportingFile("StringUtil.mustache",
|
||||
@ -198,4 +214,8 @@ public class JavaResteasyServerCodegen extends AbstractJavaJAXRSServerCodegen {
|
||||
|
||||
return objs;
|
||||
}
|
||||
|
||||
public void setGenerateJbossDeploymentDescriptor(boolean generateJbossDeploymentDescriptor) {
|
||||
this.generateJbossDeploymentDescriptor = generateJbossDeploymentDescriptor;
|
||||
}
|
||||
}
|
||||
|
@ -4,6 +4,8 @@ package io.swagger.codegen.languages.features;
|
||||
* Features supported by CXF 3 (client + server)
|
||||
*
|
||||
*/
|
||||
public interface CXFFeatures extends LoggingFeatures, GzipFeatures, BeanValidationFeatures, BeanValidationExtendedFeatures {
|
||||
public interface CXFFeatures extends LoggingFeatures, GzipFeatures, BeanValidationFeatures {
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
@ -1,17 +1,24 @@
|
||||
package io.swagger.codegen.languages.features;
|
||||
|
||||
/**
|
||||
* Features supported by CXF 3 server
|
||||
*
|
||||
*/
|
||||
public interface CXFServerFeatures extends CXFFeatures, SwaggerFeatures, SpringFeatures {
|
||||
|
||||
public static final String USE_WADL_FEATURE = "useWadlFeature";
|
||||
|
||||
public static final String USE_MULTIPART_FEATURE = "useMultipartFeature";
|
||||
|
||||
public void setUseWadlFeature(boolean useWadlFeature);
|
||||
|
||||
public void setUseMultipartFeature(boolean useMultipartFeature);
|
||||
|
||||
}
|
||||
package io.swagger.codegen.languages.features;
|
||||
|
||||
/**
|
||||
* Features supported by CXF 3 server
|
||||
*
|
||||
*/
|
||||
public interface CXFServerFeatures
|
||||
extends CXFFeatures, SwaggerFeatures, SpringFeatures, JbossFeature, BeanValidationExtendedFeatures,
|
||||
SwaggerUIFeatures
|
||||
{
|
||||
|
||||
public static final String USE_WADL_FEATURE = "useWadlFeature";
|
||||
|
||||
public static final String USE_MULTIPART_FEATURE = "useMultipartFeature";
|
||||
|
||||
public static final String ADD_CONSUMES_PRODUCES_JSON = "addConsumesProducesJson";
|
||||
|
||||
public void setUseWadlFeature(boolean useWadlFeature);
|
||||
|
||||
public void setUseMultipartFeature(boolean useMultipartFeature);
|
||||
|
||||
public void setAddConsumesProducesJson(boolean addConsumesProducesJson);
|
||||
|
||||
}
|
||||
|
@ -3,7 +3,7 @@ package io.swagger.codegen.languages.features;
|
||||
public interface GzipFeatures {
|
||||
|
||||
public static final String USE_GZIP_FEATURE = "useGzipFeature";
|
||||
|
||||
|
||||
public void setUseGzipFeature(boolean useGzipFeature);
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,9 @@
|
||||
package io.swagger.codegen.languages.features;
|
||||
|
||||
public interface GzipTestFeatures {
|
||||
|
||||
public static final String USE_GZIP_FEATURE_FOR_TESTS = "useGzipFeatureForTests";
|
||||
|
||||
public void setUseGzipFeatureForTests(boolean useGzipFeatureForTests);
|
||||
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
package io.swagger.codegen.languages.features;
|
||||
|
||||
public interface JaxbFeatures {
|
||||
public static final String USE_JAXB_ANNOTATIONS = "useJaxbAnnotations";
|
||||
|
||||
public void setUseJaxbAnnotations(boolean useJaxbAnnotations);
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
package io.swagger.codegen.languages.features;
|
||||
|
||||
public interface JbossFeature {
|
||||
|
||||
public static final String GENERATE_JBOSS_DEPLOYMENT_DESCRIPTOR = "generateJbossDeploymentDescriptor";
|
||||
|
||||
public void setGenerateJbossDeploymentDescriptor(boolean generateJbossDeploymentDescriptor);
|
||||
|
||||
}
|
@ -0,0 +1,8 @@
|
||||
package io.swagger.codegen.languages.features;
|
||||
|
||||
public interface LoggingTestFeatures {
|
||||
public static final String USE_LOGGING_FEATURE_FOR_TESTS = "useLoggingFeatureForTests";
|
||||
|
||||
public void setUseLoggingFeatureForTests(boolean useLoggingFeatureForTests);
|
||||
|
||||
}
|
@ -6,9 +6,13 @@ public interface SpringFeatures extends BeanValidationFeatures {
|
||||
|
||||
public static final String GENERATE_SPRING_BOOT_APPLICATION = "generateSpringBootApplication";
|
||||
|
||||
public static final String USE_SPRING_ANNOTATION_CONFIG = "useSpringAnnotationConfig";
|
||||
|
||||
public void setGenerateSpringApplication(boolean useGenerateSpringApplication);
|
||||
|
||||
public void setGenerateSpringBootApplication(boolean generateSpringBootApplication);
|
||||
|
||||
public void setUseSpringAnnotationConfig(boolean useSpringAnnotationConfig);
|
||||
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,9 @@
|
||||
package io.swagger.codegen.languages.features;
|
||||
|
||||
public interface SwaggerUIFeatures extends CXFFeatures {
|
||||
|
||||
public static final String USE_SWAGGER_UI = "useSwaggerUI";
|
||||
|
||||
public void setUseSwaggerUI(boolean useSwaggerUI);
|
||||
|
||||
}
|
@ -1,36 +1,44 @@
|
||||
package {{package}};
|
||||
|
||||
{{#imports}}import {{import}};
|
||||
{{/imports}}
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import javax.ws.rs.*;
|
||||
import javax.ws.rs.core.Response;
|
||||
|
||||
import org.apache.cxf.jaxrs.ext.multipart.*;
|
||||
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
{{#useBeanValidation}}
|
||||
import javax.validation.constraints.*;
|
||||
{{/useBeanValidation}}
|
||||
|
||||
@Path("/")
|
||||
@Api(value = "/", description = "{{description}}")
|
||||
public interface {{classname}} {
|
||||
{{#operations}}
|
||||
{{#operation}}
|
||||
|
||||
@{{httpMethod}}
|
||||
{{#subresourceOperation}}@Path("{{path}}"){{/subresourceOperation}}
|
||||
{{#hasConsumes}}@Consumes({ {{#consumes}}"{{{mediaType}}}"{{#hasMore}}, {{/hasMore}}{{/consumes}} }){{/hasConsumes}}
|
||||
{{#hasProduces}}@Produces({ {{#produces}}"{{{mediaType}}}"{{#hasMore}}, {{/hasMore}}{{/produces}} }){{/hasProduces}}
|
||||
@ApiOperation(value = "{{summary}}", tags={ {{#vendorExtensions.x-tags}}"{{tag}}"{{#hasMore}}, {{/hasMore}}{{/vendorExtensions.x-tags}} })
|
||||
public {{#returnType}}{{{returnType}}} {{/returnType}}{{^returnType}}void {{/returnType}} {{nickname}}({{#allParams}}{{>queryParams}}{{>pathParams}}{{>headerParams}}{{>bodyParams}}{{>formParams}}{{#hasMore}}, {{/hasMore}}{{/allParams}});
|
||||
{{/operation}}
|
||||
}
|
||||
{{/operations}}
|
||||
|
||||
package {{package}};
|
||||
|
||||
{{#imports}}import {{import}};
|
||||
{{/imports}}
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import javax.ws.rs.*;
|
||||
import javax.ws.rs.core.Response;
|
||||
import javax.ws.rs.core.MediaType;
|
||||
import org.apache.cxf.jaxrs.ext.multipart.*;
|
||||
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
{{#useBeanValidation}}
|
||||
import javax.validation.constraints.*;
|
||||
{{/useBeanValidation}}
|
||||
|
||||
@Path("/")
|
||||
@Api(value = "/", description = "{{description}}")
|
||||
{{#addConsumesProducesJson}}
|
||||
@Consumes(MediaType.APPLICATION_JSON)
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
{{/addConsumesProducesJson}}
|
||||
public interface {{classname}} {
|
||||
{{#operations}}
|
||||
{{#operation}}
|
||||
|
||||
@{{httpMethod}}
|
||||
{{#subresourceOperation}}@Path("{{path}}"){{/subresourceOperation}}
|
||||
{{#hasConsumes}}
|
||||
@Consumes({ {{#consumes}}"{{{mediaType}}}"{{#hasMore}}, {{/hasMore}}{{/consumes}} })
|
||||
{{/hasConsumes}}
|
||||
{{#hasProduces}}
|
||||
@Produces({ {{#produces}}"{{{mediaType}}}"{{#hasMore}}, {{/hasMore}}{{/produces}} })
|
||||
{{/hasProduces}}
|
||||
@ApiOperation(value = "{{summary}}", tags={ {{#vendorExtensions.x-tags}}"{{tag}}"{{#hasMore}}, {{/hasMore}}{{/vendorExtensions.x-tags}} })
|
||||
public {{#returnType}}{{{returnType}}} {{/returnType}}{{^returnType}}void {{/returnType}} {{nickname}}({{#allParams}}{{>queryParams}}{{>pathParams}}{{>headerParams}}{{>bodyParams}}{{>formParams}}{{#hasMore}}, {{/hasMore}}{{/allParams}});
|
||||
{{/operation}}
|
||||
}
|
||||
{{/operations}}
|
||||
|
||||
|
@ -16,13 +16,19 @@ import org.apache.cxf.jaxrs.model.wadl.DocTarget;
|
||||
import org.apache.cxf.jaxrs.ext.multipart.*;
|
||||
|
||||
import io.swagger.annotations.Api;
|
||||
{{#useSpringAnnotationConfig}}
|
||||
import org.springframework.stereotype.Service;
|
||||
{{/useSpringAnnotationConfig}}
|
||||
|
||||
{{#useSpringAnnotationConfig}}
|
||||
@Service("{{classname}}")
|
||||
{{/useSpringAnnotationConfig}}
|
||||
{{#description}}
|
||||
{{/description}}
|
||||
public class {{classname}}ServiceImpl implements {{classname}} {
|
||||
{{#operations}}
|
||||
{{#operation}}
|
||||
public {{#returnType}}{{{returnType}}} {{/returnType}}{{^returnType}}void {{/returnType}} {{nickname}}({{#allParams}}{{>queryParamsImpl}}{{>pathParams}}{{>headerParams}}{{>bodyParams}}{{>formParams}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) {
|
||||
public {{#returnType}}{{{returnType}}} {{/returnType}}{{^returnType}}void {{/returnType}} {{nickname}}({{#allParams}}{{>queryParamsImpl}}{{>pathParamsImpl}}{{>headerParamsImpl}}{{>bodyParams}}{{>formParamsImpl}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) {
|
||||
// TODO: Implement...
|
||||
|
||||
{{^vendorExtensions.x-java-is-response-void}}return null;{{/vendorExtensions.x-java-is-response-void}}
|
||||
|
@ -6,6 +6,7 @@ package {{package}};
|
||||
{{/imports}}
|
||||
import org.junit.Test;
|
||||
import org.junit.Before;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
import javax.ws.rs.core.Response;
|
||||
import org.apache.cxf.jaxrs.client.JAXRSClientFactory;
|
||||
@ -65,7 +66,7 @@ public class {{classname}}Test {
|
||||
providers.add(provider);
|
||||
|
||||
{{#generateSpringBootApplication}}
|
||||
api = JAXRSClientFactory.create("http://localhost:" + serverPort + "/services/services", {{classname}}.class, providers);
|
||||
api = JAXRSClientFactory.create("http://localhost:" + serverPort + "/services", {{classname}}.class, providers);
|
||||
{{/generateSpringBootApplication}}
|
||||
{{^generateSpringBootApplication}}
|
||||
api = JAXRSClientFactory.create("{{basePath}}", {{classname}}.class, providers);
|
||||
@ -73,7 +74,7 @@ public class {{classname}}Test {
|
||||
org.apache.cxf.jaxrs.client.Client client = WebClient.client(api);
|
||||
|
||||
ClientConfiguration config = WebClient.getConfig(client);
|
||||
{{#useGzipFeature}}
|
||||
{{#useGzipFeatureForTests}}
|
||||
// Example for using Gzipping
|
||||
GZIPOutInterceptor gzipOutInterceptor = new GZIPOutInterceptor();
|
||||
// use Gzipping for first request sent to server
|
||||
@ -81,11 +82,11 @@ public class {{classname}}Test {
|
||||
config.getOutInterceptors().add(gzipOutInterceptor);
|
||||
|
||||
config.getInInterceptors().add(new GZIPInInterceptor());
|
||||
{{/useGzipFeature}}
|
||||
{{#useLoggingFeature}}
|
||||
{{/useGzipFeatureForTests}}
|
||||
{{#useLoggingFeatureForTests}}
|
||||
LoggingOutInterceptor loggingOutInterceptor = new LoggingOutInterceptor();
|
||||
config.getOutInterceptors().add(loggingOutInterceptor);
|
||||
{{/useLoggingFeature}}
|
||||
{{/useLoggingFeatureForTests}}
|
||||
}
|
||||
|
||||
{{#operations}}{{#operation}}
|
||||
@ -100,11 +101,13 @@ public class {{classname}}Test {
|
||||
@Test
|
||||
public void {{operationId}}Test() {
|
||||
{{#allParams}}
|
||||
{{{dataType}}} {{paramName}} = null;
|
||||
{{^isFile}}{{{dataType}}} {{paramName}} = null;{{/isFile}}{{#isFile}}org.apache.cxf.jaxrs.ext.multipart.Attachment {{paramName}} = null;{{/isFile}}
|
||||
{{/allParams}}
|
||||
// {{#returnType}}{{{returnType}}} response = {{/returnType}}api.{{operationId}}({{#allParams}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}});
|
||||
|
||||
//{{^vendorExtensions.x-java-is-response-void}}{{{returnType}}} response = {{/vendorExtensions.x-java-is-response-void}}api.{{operationId}}({{#allParams}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}});
|
||||
{{^vendorExtensions.x-java-is-response-void}}//assertNotNull(response);{{/vendorExtensions.x-java-is-response-void}}
|
||||
// TODO: test validations
|
||||
|
||||
|
||||
}
|
||||
{{/operation}}{{/operations}}
|
||||
}
|
||||
|
@ -0,0 +1 @@
|
||||
{{#required}} @NotNull{{/required}}{{#pattern}} @Pattern(regexp="{{pattern}}"){{/pattern}}{{#minLength}}{{#maxLength}} @Size(min={{minLength}},max={{maxLength}}){{/maxLength}}{{/minLength}}{{#minLength}}{{^maxLength}} @Size(min={{minLength}}){{/maxLength}}{{/minLength}}{{^minLength}}{{#maxLength}} @Size(max={{maxLength}}){{/maxLength}}{{/minLength}}{{#minItems}}{{#maxItems}} @Size(min={{minItems}},max={{maxItems}}){{/maxItems}}{{/minItems}}{{#minItems}}{{^maxItems}} @Size(min={{minItems}}){{/maxItems}}{{/minItems}}{{^minItems}}{{#maxItems}} @Size(max={{maxItems}}){{/maxItems}}{{/minItems}}{{#minimum}}/* @Min({{minimum}}) */{{/minimum}}{{#maximum}}/* @Max({{maximum}}) */{{/maximum}}
|
@ -0,0 +1,43 @@
|
||||
{{#jackson}}
|
||||
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||
import com.fasterxml.jackson.annotation.JsonValue;
|
||||
{{/jackson}}
|
||||
|
||||
/**
|
||||
* {{^description}}Gets or Sets {{{name}}}{{/description}}{{#description}}{{{description}}}{{/description}}
|
||||
*/
|
||||
public enum {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} {
|
||||
{{#gson}}
|
||||
{{#allowableValues}}{{#enumVars}}
|
||||
@SerializedName({{#isInteger}}"{{/isInteger}}{{#isDouble}}"{{/isDouble}}{{#isLong}}"{{/isLong}}{{#isFloat}}"{{/isFloat}}{{{value}}}{{#isInteger}}"{{/isInteger}}{{#isDouble}}"{{/isDouble}}{{#isLong}}"{{/isLong}}{{#isFloat}}"{{/isFloat}})
|
||||
{{{name}}}({{{value}}}){{^-last}},
|
||||
{{/-last}}{{#-last}};{{/-last}}{{/enumVars}}{{/allowableValues}}
|
||||
{{/gson}}
|
||||
{{^gson}}
|
||||
{{#allowableValues}}{{#enumVars}}
|
||||
{{{name}}}({{{value}}}){{^-last}},
|
||||
{{/-last}}{{#-last}};{{/-last}}{{/enumVars}}{{/allowableValues}}
|
||||
{{/gson}}
|
||||
|
||||
private {{{dataType}}} value;
|
||||
|
||||
{{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}}({{{dataType}}} value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@Override
|
||||
@JsonValue
|
||||
public String toString() {
|
||||
return String.valueOf(value);
|
||||
}
|
||||
|
||||
@JsonCreator
|
||||
public static {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} fromValue(String text) {
|
||||
for ({{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} b : {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}}.values()) {
|
||||
if (String.valueOf(b.value).equals(text)) {
|
||||
return b;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
@ -1,2 +1 @@
|
||||
{{#isFormParam}}{{#notFile}}@Multipart(value = "{{paramName}}"{{^required}}, required = false{{/required}}) {{{dataType}}} {{paramName}}{{/notFile}}{{#isFile}} @Multipart(value = "{{paramName}}"{{^required}}, required = false{{/required}}) InputStream {{paramName}}InputStream,
|
||||
@Multipart(value = "{{paramName}}" {{^required}}, required = false{{/required}}) Attachment {{paramName}}Detail{{/isFile}}{{/isFormParam}}
|
||||
{{#isFormParam}}{{#notFile}}@Multipart(value = "{{paramName}}"{{^required}}, required = false{{/required}}) {{{dataType}}} {{paramName}}{{/notFile}}{{#isFile}} @Multipart(value = "{{paramName}}" {{^required}}, required = false{{/required}}) Attachment {{paramName}}Detail{{/isFile}}{{/isFormParam}}
|
@ -0,0 +1 @@
|
||||
{{#isFormParam}}{{#notFile}}{{{dataType}}} {{paramName}}{{/notFile}}{{#isFile}} Attachment {{paramName}}Detail{{/isFile}}{{/isFormParam}}
|
@ -0,0 +1 @@
|
||||
{{#isHeaderParam}}{{{dataType}}} {{paramName}}{{/isHeaderParam}}
|
@ -9,7 +9,7 @@ import javax.validation.constraints.*;
|
||||
{{#models}}
|
||||
{{#model}}
|
||||
{{#isEnum}}
|
||||
{{>enumClass}}
|
||||
{{>enumOuterClass}}
|
||||
{{/isEnum}}
|
||||
{{^isEnum}}
|
||||
{{>pojo}}
|
||||
|
@ -0,0 +1 @@
|
||||
{{#isPathParam}}{{{dataType}}} {{paramName}}{{/isPathParam}}
|
@ -7,12 +7,14 @@ import javax.xml.bind.annotation.XmlType;
|
||||
import javax.xml.bind.annotation.XmlEnum;
|
||||
import javax.xml.bind.annotation.XmlEnumValue;
|
||||
|
||||
{{#useJaxbAnnotations}}
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
{{#hasVars}} @XmlType(name = "{{classname}}", propOrder =
|
||||
{ {{#vars}}"{{name}}"{{^-last}}, {{/-last}}{{/vars}}
|
||||
}){{/hasVars}}
|
||||
{{^hasVars}}@XmlType(name = "{{classname}}"){{/hasVars}}
|
||||
{{^parent}}@XmlRootElement(name="{{classname}}"){{/parent}}
|
||||
{{/useJaxbAnnotations}}
|
||||
{{#description}}
|
||||
@ApiModel(description="{{{description}}}")
|
||||
{{/description}}
|
||||
@ -22,8 +24,9 @@ public class {{classname}} {{#parent}}extends {{{parent}}}{{/parent}} {
|
||||
{{>enumClass}}{{/isEnum}}{{#items.isEnum}}{{#items}}
|
||||
|
||||
{{>enumClass}}{{/items}}{{/items.isEnum}}
|
||||
|
||||
{{#useJaxbAnnotations}}
|
||||
@XmlElement(name="{{baseName}}")
|
||||
{{/useJaxbAnnotations}}
|
||||
@ApiModelProperty({{#example}}example = "{{example}}", {{/example}}{{#required}}required = {{required}}, {{/required}}value = "{{{description}}}")
|
||||
private {{{datatypeWithEnum}}} {{name}} = {{{defaultValue}}};{{/vars}}
|
||||
|
||||
|
@ -1 +1 @@
|
||||
{{#isQueryParam}}@QueryParam("{{baseName}}"){{#useBeanValidation}}{{>beanValidation}}{{/useBeanValidation}}{{{dataType}}} {{paramName}}{{/isQueryParam}}
|
||||
{{#isQueryParam}}@QueryParam("{{baseName}}"){{#useBeanValidation}}{{>beanValidationQueryParams}}{{/useBeanValidation}}{{{dataType}}} {{paramName}}{{/isQueryParam}}
|
@ -11,8 +11,6 @@
|
||||
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
|
||||
http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee.xsd">
|
||||
|
||||
|
||||
|
||||
<import resource="classpath:META-INF/cxf/cxf.xml" />
|
||||
|
||||
<!-- JAXRS providers -->
|
||||
@ -23,18 +21,27 @@
|
||||
{{/useMultipartFeature}}
|
||||
|
||||
<!-- Controller -->
|
||||
{{#useSpringAnnotationConfig}}
|
||||
<context:annotation-config/>
|
||||
<context:component-scan base-package="{{apiPackage}}.impl" />
|
||||
{{/useSpringAnnotationConfig}}
|
||||
{{^useSpringAnnotationConfig}}
|
||||
{{#apiInfo}}
|
||||
{{#apis}}
|
||||
<bean id="{{classname}}" class="{{package}}.impl.{{classname}}ServiceImpl" />
|
||||
{{/apis}}
|
||||
{{/apiInfo}}
|
||||
{{/useSpringAnnotationConfig}}
|
||||
|
||||
{{#useSwaggerFeature}}
|
||||
<!-- CXF Swagger2Feature -->
|
||||
{{! http://cxf.apache.org/docs/swagger2feature.html }}
|
||||
<bean id="swagger2Feature" class="org.apache.cxf.jaxrs.swagger.Swagger2Feature">
|
||||
<!--property name="basePath" value="/"/>
|
||||
<property name="contact" value="${swagger.contact}" />
|
||||
<!--property name="basePath" value="/services"/-->
|
||||
{{#useSwaggerUI}}
|
||||
<property name="supportSwaggerUi" value="true" />
|
||||
{{/useSwaggerUI}}
|
||||
<!--property name="contact" value="${swagger.contact}" />
|
||||
<property name="title" value="${swagger.title}" />
|
||||
<property name="version" value="${swagger.version}" />
|
||||
<property name="description" value="${swagger.description}" />
|
||||
|
@ -0,0 +1 @@
|
||||
cxf.path=/
|
@ -82,7 +82,7 @@
|
||||
<artifactId>maven-war-plugin</artifactId>
|
||||
<version>2.1.1</version>
|
||||
<configuration>
|
||||
<failOnMissingWebXml>true</failOnMissingWebXml>
|
||||
<failOnMissingWebXml>false</failOnMissingWebXml>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
@ -196,6 +196,13 @@
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
{{/generateSpringBootApplication}}
|
||||
{{#useSwaggerUI}}
|
||||
<dependency>
|
||||
<groupId>org.webjars</groupId>
|
||||
<artifactId>swagger-ui</artifactId>
|
||||
<version>2.1.8-M1</version>
|
||||
</dependency>
|
||||
{{/useSwaggerUI}}
|
||||
</dependencies>
|
||||
<repositories>
|
||||
<repository>
|
||||
@ -210,7 +217,7 @@
|
||||
<java.version>{{#java8}}1.8{{/java8}}{{^java8}}1.7{{/java8}}</java.version>
|
||||
<maven.compiler.source>${java.version}</maven.compiler.source>
|
||||
<maven.compiler.target>${java.version}</maven.compiler.target>
|
||||
<swagger-core-version>1.5.9</swagger-core-version>
|
||||
<swagger-core-version>1.5.10</swagger-core-version>
|
||||
<jetty-version>9.2.9.v20150224</jetty-version>
|
||||
<jersey2-version>2.22.2</jersey2-version>
|
||||
<junit-version>4.12</junit-version>
|
||||
@ -225,7 +232,7 @@
|
||||
{{#generateSpringBootApplication}}
|
||||
<spring.boot-version>1.3.3.RELEASE</spring.boot-version>
|
||||
{{/generateSpringBootApplication}}
|
||||
<cxf-version>3.1.7</cxf-version>
|
||||
<cxf-version>3.1.8</cxf-version>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
</project>
|
||||
|
@ -5,12 +5,25 @@
|
||||
* Bean-Validation-API support
|
||||
* Spring-configuration of Swagger, WADL and Endpoints
|
||||
* Swagger-API is accessible (CXF3 Swagger2Feature)
|
||||
* Swagger-UI can be included as Web-Jar automatically
|
||||
* WADL is accessible (CXF WADL-Generator)
|
||||
* Unit-tests include Gzip-Interceptors for demonstration
|
||||
|
||||
|
||||
## Urls to access the REST API
|
||||
### Urls for Spring Boot
|
||||
|
||||
* Available services listing
|
||||
http://localhost:8080/
|
||||
|
||||
* Swagger API
|
||||
http://localhost:8080/services/swagger.json
|
||||
|
||||
* CXF WADL
|
||||
http://localhost:8080/services?_wadl
|
||||
|
||||
|
||||
### Urls if deployed to an AS
|
||||
* Available services listing
|
||||
http://localhost:8080/swagger-cxf-server/rest/services/
|
||||
|
||||
|
@ -0,0 +1,25 @@
|
||||
# Swagger Codegen Ignore
|
||||
# Generated by swagger-codegen https://github.com/swagger-api/swagger-codegen
|
||||
|
||||
# Use this file to prevent files from being overwritten by the generator.
|
||||
# The patterns follow closely to .gitignore or .dockerignore.
|
||||
|
||||
# As an example, the C# client generator defines ApiClient.cs.
|
||||
# You can make changes and tell Swagger Codgen to ignore just this file by uncommenting the following line:
|
||||
#ApiClient.cs
|
||||
|
||||
# You can match any string of characters against a directory, file or extension with a single asterisk (*):
|
||||
#foo/*/qux
|
||||
# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux
|
||||
|
||||
# You can recursively match patterns against a directory, file or extension with a double asterisk (**):
|
||||
#foo/**/qux
|
||||
# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux
|
||||
|
||||
# You can also negate patterns with an exclamation (!).
|
||||
# For example, you can ignore all files in a docs folder with the file extension .md:
|
||||
#docs/*.md
|
||||
# Then explicitly reverse the ignore rule for a single file:
|
||||
#!docs/README.md
|
||||
|
||||
**/impl/*
|
@ -0,0 +1,67 @@
|
||||
package io.swagger.codegen.jaxrs;
|
||||
|
||||
import io.swagger.codegen.AbstractOptionsTest;
|
||||
import io.swagger.codegen.CodegenConfig;
|
||||
import io.swagger.codegen.languages.JavaResteasyServerCodegen;
|
||||
import io.swagger.codegen.options.JavaResteasyServerOptionsProvider;
|
||||
import io.swagger.codegen.options.OptionsProvider;
|
||||
import mockit.Expectations;
|
||||
import mockit.Tested;
|
||||
|
||||
public class JavaResteasyServerOptionsTest extends AbstractOptionsTest {
|
||||
|
||||
@Tested
|
||||
private JavaResteasyServerCodegen clientCodegen;
|
||||
|
||||
public JavaResteasyServerOptionsTest() {
|
||||
super(new JavaResteasyServerOptionsProvider());
|
||||
}
|
||||
|
||||
protected JavaResteasyServerOptionsTest(OptionsProvider optionsProvider) {
|
||||
super(optionsProvider);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected CodegenConfig getCodegenConfig() {
|
||||
return clientCodegen;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setExpectations() {
|
||||
new Expectations(clientCodegen) {
|
||||
{
|
||||
clientCodegen.setModelPackage(JavaResteasyServerOptionsProvider.MODEL_PACKAGE_VALUE);
|
||||
times = 1;
|
||||
clientCodegen.setApiPackage(JavaResteasyServerOptionsProvider.API_PACKAGE_VALUE);
|
||||
times = 1;
|
||||
clientCodegen.setSortParamsByRequiredFlag(
|
||||
Boolean.valueOf(JavaResteasyServerOptionsProvider.SORT_PARAMS_VALUE));
|
||||
times = 1;
|
||||
clientCodegen.setInvokerPackage(JavaResteasyServerOptionsProvider.INVOKER_PACKAGE_VALUE);
|
||||
times = 1;
|
||||
clientCodegen.setGroupId(JavaResteasyServerOptionsProvider.GROUP_ID_VALUE);
|
||||
times = 1;
|
||||
clientCodegen.setArtifactId(JavaResteasyServerOptionsProvider.ARTIFACT_ID_VALUE);
|
||||
times = 1;
|
||||
clientCodegen.setArtifactVersion(JavaResteasyServerOptionsProvider.ARTIFACT_VERSION_VALUE);
|
||||
times = 1;
|
||||
clientCodegen.setSourceFolder(JavaResteasyServerOptionsProvider.SOURCE_FOLDER_VALUE);
|
||||
times = 1;
|
||||
clientCodegen.setLocalVariablePrefix(JavaResteasyServerOptionsProvider.LOCAL_PREFIX_VALUE);
|
||||
times = 1;
|
||||
clientCodegen.setSerializableModel(
|
||||
Boolean.valueOf(JavaResteasyServerOptionsProvider.SERIALIZABLE_MODEL_VALUE));
|
||||
times = 1;
|
||||
clientCodegen.setFullJavaUtil(Boolean.valueOf(JavaResteasyServerOptionsProvider.FULL_JAVA_UTIL_VALUE));
|
||||
times = 1;
|
||||
clientCodegen.setSerializeBigDecimalAsString(true);
|
||||
times = 1;
|
||||
|
||||
clientCodegen.setGenerateJbossDeploymentDescriptor(
|
||||
Boolean.valueOf(JavaResteasyServerOptionsProvider.GENERATE_JBOSS_DEPLOYMENT_DESCRIPTOR));
|
||||
times = 1;
|
||||
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
@ -0,0 +1,74 @@
|
||||
package io.swagger.codegen.jaxrs;
|
||||
|
||||
import io.swagger.codegen.AbstractOptionsTest;
|
||||
import io.swagger.codegen.CodegenConfig;
|
||||
import io.swagger.codegen.languages.JavaCXFClientCodegen;
|
||||
import io.swagger.codegen.options.JavaCXFClientOptionsProvider;
|
||||
import io.swagger.codegen.options.OptionsProvider;
|
||||
import mockit.Expectations;
|
||||
import mockit.Tested;
|
||||
|
||||
public class JaxrsCXFClientOptionsTest extends AbstractOptionsTest {
|
||||
|
||||
@Tested
|
||||
private JavaCXFClientCodegen clientCodegen;
|
||||
|
||||
public JaxrsCXFClientOptionsTest() {
|
||||
super(new JavaCXFClientOptionsProvider());
|
||||
}
|
||||
|
||||
protected JaxrsCXFClientOptionsTest(OptionsProvider optionsProvider) {
|
||||
super(optionsProvider);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected CodegenConfig getCodegenConfig() {
|
||||
return clientCodegen;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setExpectations() {
|
||||
new Expectations(clientCodegen) {
|
||||
{
|
||||
clientCodegen.setModelPackage(JavaCXFClientOptionsProvider.MODEL_PACKAGE_VALUE);
|
||||
times = 1;
|
||||
clientCodegen.setApiPackage(JavaCXFClientOptionsProvider.API_PACKAGE_VALUE);
|
||||
times = 1;
|
||||
clientCodegen
|
||||
.setSortParamsByRequiredFlag(Boolean.valueOf(JavaCXFClientOptionsProvider.SORT_PARAMS_VALUE));
|
||||
times = 1;
|
||||
clientCodegen.setInvokerPackage(JavaCXFClientOptionsProvider.INVOKER_PACKAGE_VALUE);
|
||||
times = 1;
|
||||
clientCodegen.setGroupId(JavaCXFClientOptionsProvider.GROUP_ID_VALUE);
|
||||
times = 1;
|
||||
clientCodegen.setArtifactId(JavaCXFClientOptionsProvider.ARTIFACT_ID_VALUE);
|
||||
times = 1;
|
||||
clientCodegen.setArtifactVersion(JavaCXFClientOptionsProvider.ARTIFACT_VERSION_VALUE);
|
||||
times = 1;
|
||||
clientCodegen.setSourceFolder(JavaCXFClientOptionsProvider.SOURCE_FOLDER_VALUE);
|
||||
times = 1;
|
||||
clientCodegen.setLocalVariablePrefix(JavaCXFClientOptionsProvider.LOCAL_PREFIX_VALUE);
|
||||
times = 1;
|
||||
clientCodegen
|
||||
.setSerializableModel(Boolean.valueOf(JavaCXFClientOptionsProvider.SERIALIZABLE_MODEL_VALUE));
|
||||
times = 1;
|
||||
clientCodegen.setFullJavaUtil(Boolean.valueOf(JavaCXFClientOptionsProvider.FULL_JAVA_UTIL_VALUE));
|
||||
times = 1;
|
||||
clientCodegen.setSerializeBigDecimalAsString(true);
|
||||
times = 1;
|
||||
|
||||
clientCodegen.setUseBeanValidation(Boolean.valueOf(JavaCXFClientOptionsProvider.USE_BEANVALIDATION));
|
||||
times = 1;
|
||||
clientCodegen.setUseLoggingFeatureForTests(
|
||||
Boolean.valueOf(JavaCXFClientOptionsProvider.USE_LOGGING_FEATURE_FOR_TESTS));
|
||||
times = 1;
|
||||
|
||||
|
||||
clientCodegen.setUseJaxbAnnotations(Boolean.valueOf(JavaCXFClientOptionsProvider.USE_JAXB_ANNOTATIONS));
|
||||
times = 1;
|
||||
|
||||
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
@ -1,80 +1,108 @@
|
||||
package io.swagger.codegen.jaxrs;
|
||||
|
||||
import io.swagger.codegen.AbstractOptionsTest;
|
||||
import io.swagger.codegen.CodegenConfig;
|
||||
import io.swagger.codegen.languages.JavaCXFServerCodegen;
|
||||
import io.swagger.codegen.options.JavaCXFServerOptionsProvider;
|
||||
import io.swagger.codegen.options.OptionsProvider;
|
||||
import mockit.Expectations;
|
||||
import mockit.Tested;
|
||||
|
||||
public class JaxrsCXFServerOptionsTest extends AbstractOptionsTest {
|
||||
|
||||
@Tested
|
||||
private JavaCXFServerCodegen clientCodegen;
|
||||
|
||||
public JaxrsCXFServerOptionsTest() {
|
||||
super(new JavaCXFServerOptionsProvider());
|
||||
}
|
||||
|
||||
protected JaxrsCXFServerOptionsTest(OptionsProvider optionsProvider) {
|
||||
super(optionsProvider);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected CodegenConfig getCodegenConfig() {
|
||||
return clientCodegen;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setExpectations() {
|
||||
new Expectations(clientCodegen) {{
|
||||
clientCodegen.setModelPackage(JavaCXFServerOptionsProvider.MODEL_PACKAGE_VALUE);
|
||||
times = 1;
|
||||
clientCodegen.setApiPackage(JavaCXFServerOptionsProvider.API_PACKAGE_VALUE);
|
||||
times = 1;
|
||||
clientCodegen.setSortParamsByRequiredFlag(Boolean.valueOf(JavaCXFServerOptionsProvider.SORT_PARAMS_VALUE));
|
||||
times = 1;
|
||||
clientCodegen.setInvokerPackage(JavaCXFServerOptionsProvider.INVOKER_PACKAGE_VALUE);
|
||||
times = 1;
|
||||
clientCodegen.setGroupId(JavaCXFServerOptionsProvider.GROUP_ID_VALUE);
|
||||
times = 1;
|
||||
clientCodegen.setArtifactId(JavaCXFServerOptionsProvider.ARTIFACT_ID_VALUE);
|
||||
times = 1;
|
||||
clientCodegen.setArtifactVersion(JavaCXFServerOptionsProvider.ARTIFACT_VERSION_VALUE);
|
||||
times = 1;
|
||||
clientCodegen.setSourceFolder(JavaCXFServerOptionsProvider.SOURCE_FOLDER_VALUE);
|
||||
times = 1;
|
||||
clientCodegen.setLocalVariablePrefix(JavaCXFServerOptionsProvider.LOCAL_PREFIX_VALUE);
|
||||
times = 1;
|
||||
clientCodegen.setSerializableModel(Boolean.valueOf(JavaCXFServerOptionsProvider.SERIALIZABLE_MODEL_VALUE));
|
||||
times = 1;
|
||||
clientCodegen.setFullJavaUtil(Boolean.valueOf(JavaCXFServerOptionsProvider.FULL_JAVA_UTIL_VALUE));
|
||||
times = 1;
|
||||
clientCodegen.setSerializeBigDecimalAsString(true);
|
||||
times = 1;
|
||||
|
||||
clientCodegen.setUseBeanValidation(Boolean.valueOf(JavaCXFServerOptionsProvider.USE_BEANVALIDATION));
|
||||
times = 1;
|
||||
|
||||
clientCodegen.setGenerateSpringApplication(Boolean.valueOf(JavaCXFServerOptionsProvider.USE_SWAGGER_FEATURE));
|
||||
times = 1;
|
||||
clientCodegen.setUseWadlFeature(Boolean.valueOf(JavaCXFServerOptionsProvider.USE_WADL_FEATURE));
|
||||
times = 1;
|
||||
clientCodegen.setUseMultipartFeature(Boolean.valueOf(JavaCXFServerOptionsProvider.USE_MULTIPART_FEATURE));
|
||||
times = 1;
|
||||
clientCodegen.setUseGzipFeature(Boolean.valueOf(JavaCXFServerOptionsProvider.USE_GZIP_FEATURE));
|
||||
times = 1;
|
||||
clientCodegen.setUseLoggingFeature(Boolean.valueOf(JavaCXFServerOptionsProvider.USE_LOGGING_FEATURE));
|
||||
times = 1;
|
||||
clientCodegen.setUseBeanValidationFeature(Boolean.valueOf(JavaCXFServerOptionsProvider.USE_BEANVALIDATION_FEATURE));
|
||||
times = 1;
|
||||
|
||||
clientCodegen.setGenerateSpringBootApplication(Boolean.valueOf(JavaCXFServerOptionsProvider.GENERATE_SPRING_BOOT_APPLICATION));
|
||||
times = 1;
|
||||
|
||||
|
||||
|
||||
}};
|
||||
}
|
||||
}
|
||||
package io.swagger.codegen.jaxrs;
|
||||
|
||||
import io.swagger.codegen.AbstractOptionsTest;
|
||||
import io.swagger.codegen.CodegenConfig;
|
||||
import io.swagger.codegen.languages.JavaCXFServerCodegen;
|
||||
import io.swagger.codegen.options.JavaCXFServerOptionsProvider;
|
||||
import io.swagger.codegen.options.OptionsProvider;
|
||||
import mockit.Expectations;
|
||||
import mockit.Tested;
|
||||
|
||||
public class JaxrsCXFServerOptionsTest extends AbstractOptionsTest {
|
||||
|
||||
@Tested
|
||||
private JavaCXFServerCodegen clientCodegen;
|
||||
|
||||
public JaxrsCXFServerOptionsTest() {
|
||||
super(new JavaCXFServerOptionsProvider());
|
||||
}
|
||||
|
||||
protected JaxrsCXFServerOptionsTest(OptionsProvider optionsProvider) {
|
||||
super(optionsProvider);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected CodegenConfig getCodegenConfig() {
|
||||
return clientCodegen;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setExpectations() {
|
||||
new Expectations(clientCodegen) {
|
||||
{
|
||||
clientCodegen.setModelPackage(JavaCXFServerOptionsProvider.MODEL_PACKAGE_VALUE);
|
||||
times = 1;
|
||||
clientCodegen.setApiPackage(JavaCXFServerOptionsProvider.API_PACKAGE_VALUE);
|
||||
times = 1;
|
||||
clientCodegen
|
||||
.setSortParamsByRequiredFlag(Boolean.valueOf(JavaCXFServerOptionsProvider.SORT_PARAMS_VALUE));
|
||||
times = 1;
|
||||
clientCodegen.setInvokerPackage(JavaCXFServerOptionsProvider.INVOKER_PACKAGE_VALUE);
|
||||
times = 1;
|
||||
clientCodegen.setGroupId(JavaCXFServerOptionsProvider.GROUP_ID_VALUE);
|
||||
times = 1;
|
||||
clientCodegen.setArtifactId(JavaCXFServerOptionsProvider.ARTIFACT_ID_VALUE);
|
||||
times = 1;
|
||||
clientCodegen.setArtifactVersion(JavaCXFServerOptionsProvider.ARTIFACT_VERSION_VALUE);
|
||||
times = 1;
|
||||
clientCodegen.setSourceFolder(JavaCXFServerOptionsProvider.SOURCE_FOLDER_VALUE);
|
||||
times = 1;
|
||||
clientCodegen.setLocalVariablePrefix(JavaCXFServerOptionsProvider.LOCAL_PREFIX_VALUE);
|
||||
times = 1;
|
||||
clientCodegen
|
||||
.setSerializableModel(Boolean.valueOf(JavaCXFServerOptionsProvider.SERIALIZABLE_MODEL_VALUE));
|
||||
times = 1;
|
||||
clientCodegen.setFullJavaUtil(Boolean.valueOf(JavaCXFServerOptionsProvider.FULL_JAVA_UTIL_VALUE));
|
||||
times = 1;
|
||||
clientCodegen.setSerializeBigDecimalAsString(true);
|
||||
times = 1;
|
||||
|
||||
clientCodegen.setUseBeanValidation(Boolean.valueOf(JavaCXFServerOptionsProvider.USE_BEANVALIDATION));
|
||||
times = 1;
|
||||
|
||||
clientCodegen.setGenerateSpringApplication(
|
||||
Boolean.valueOf(JavaCXFServerOptionsProvider.USE_SWAGGER_FEATURE));
|
||||
times = 1;
|
||||
clientCodegen.setUseWadlFeature(Boolean.valueOf(JavaCXFServerOptionsProvider.USE_WADL_FEATURE));
|
||||
times = 1;
|
||||
clientCodegen
|
||||
.setUseMultipartFeature(Boolean.valueOf(JavaCXFServerOptionsProvider.USE_MULTIPART_FEATURE));
|
||||
times = 1;
|
||||
clientCodegen.setUseGzipFeature(Boolean.valueOf(JavaCXFServerOptionsProvider.USE_GZIP_FEATURE));
|
||||
times = 1;
|
||||
clientCodegen.setUseGzipFeatureForTests(Boolean.valueOf(JavaCXFServerOptionsProvider.USE_GZIP_FEATURE));
|
||||
times = 1;
|
||||
clientCodegen.setUseLoggingFeature(Boolean.valueOf(JavaCXFServerOptionsProvider.USE_LOGGING_FEATURE));
|
||||
times = 1;
|
||||
clientCodegen.setUseLoggingFeatureForTests(
|
||||
Boolean.valueOf(JavaCXFServerOptionsProvider.USE_LOGGING_FEATURE_FOR_TESTS));
|
||||
times = 1;
|
||||
clientCodegen.setUseBeanValidationFeature(
|
||||
Boolean.valueOf(JavaCXFServerOptionsProvider.USE_BEANVALIDATION_FEATURE));
|
||||
times = 1;
|
||||
|
||||
clientCodegen.setGenerateSpringBootApplication(
|
||||
Boolean.valueOf(JavaCXFServerOptionsProvider.GENERATE_SPRING_BOOT_APPLICATION));
|
||||
times = 1;
|
||||
|
||||
clientCodegen.setUseJaxbAnnotations(Boolean.valueOf(JavaCXFServerOptionsProvider.USE_JAXB_ANNOTATIONS));
|
||||
times = 1;
|
||||
|
||||
clientCodegen.setUseSpringAnnotationConfig(
|
||||
Boolean.valueOf(JavaCXFServerOptionsProvider.USE_SPRING_ANNOTATION_CONFIG));
|
||||
times = 1;
|
||||
|
||||
clientCodegen.setGenerateJbossDeploymentDescriptor(
|
||||
Boolean.valueOf(JavaCXFServerOptionsProvider.GENERATE_JBOSS_DEPLOYMENT_DESCRIPTOR));
|
||||
times = 1;
|
||||
|
||||
clientCodegen.setUseSwaggerUI(Boolean.valueOf(JavaCXFServerOptionsProvider.USE_SWAGGER_UI));
|
||||
times = 1;
|
||||
|
||||
clientCodegen.setAddConsumesProducesJson(
|
||||
Boolean.valueOf(JavaCXFServerOptionsProvider.ADD_CONSUMES_PRODUCES_JSON));
|
||||
times = 1;
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,47 @@
|
||||
package io.swagger.codegen.options;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
|
||||
import io.swagger.codegen.languages.JavaCXFClientCodegen;
|
||||
|
||||
public class JavaCXFClientOptionsProvider extends JavaOptionsProvider {
|
||||
|
||||
public static final String USE_BEANVALIDATION = "true";
|
||||
|
||||
public static final String USE_JAXB_ANNOTATIONS = "true";
|
||||
|
||||
public static final String USE_GZIP_FEATURE_FOR_TESTS = "true";
|
||||
|
||||
public static final String USE_LOGGING_FEATURE_FOR_TESTS = "true";
|
||||
|
||||
|
||||
@Override
|
||||
public boolean isServer() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getLanguage() {
|
||||
return "jaxrs-cxf-client";
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, String> createOptions() {
|
||||
|
||||
Map<String, String> parentOptions = super.createOptions();
|
||||
|
||||
ImmutableMap.Builder<String, String> builder = new ImmutableMap.Builder<String, String>()
|
||||
.putAll(parentOptions);
|
||||
|
||||
builder.put(JavaCXFClientCodegen.USE_BEANVALIDATION, JavaCXFClientOptionsProvider.USE_BEANVALIDATION);
|
||||
builder.put(JavaCXFClientCodegen.USE_JAXB_ANNOTATIONS, USE_JAXB_ANNOTATIONS);
|
||||
|
||||
builder.put(JavaCXFClientCodegen.USE_GZIP_FEATURE_FOR_TESTS, USE_GZIP_FEATURE_FOR_TESTS);
|
||||
builder.put(JavaCXFClientCodegen.USE_LOGGING_FEATURE_FOR_TESTS, USE_LOGGING_FEATURE_FOR_TESTS);
|
||||
|
||||
return builder.build();
|
||||
|
||||
}
|
||||
}
|
@ -1,65 +1,91 @@
|
||||
package io.swagger.codegen.options;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
|
||||
import io.swagger.codegen.CodegenConstants;
|
||||
import io.swagger.codegen.languages.JavaCXFServerCodegen;
|
||||
|
||||
public class JavaCXFServerOptionsProvider extends JavaOptionsProvider {
|
||||
|
||||
public static final String GENERATE_SPRING_APPLICATION = "true";
|
||||
|
||||
public static final String USE_SWAGGER_FEATURE = "true";
|
||||
|
||||
public static final String USE_WADL_FEATURE = "true";
|
||||
|
||||
public static final String USE_MULTIPART_FEATURE = "true";
|
||||
|
||||
public static final String USE_GZIP_FEATURE = "true";
|
||||
|
||||
public static final String USE_LOGGING_FEATURE = "true";
|
||||
|
||||
public static final String USE_BEANVALIDATION_FEATURE = "true";
|
||||
|
||||
public static final String GENERATE_SPRING_BOOT_APPLICATION = "true";
|
||||
|
||||
public static final String IMPL_FOLDER_VALUE = "src/main/java";
|
||||
|
||||
@Override
|
||||
public boolean isServer() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getLanguage() {
|
||||
return "jaxrs-cxf";
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, String> createOptions() {
|
||||
|
||||
Map<String, String> parentOptions = super.createOptions();
|
||||
|
||||
ImmutableMap.Builder<String, String> builder = new ImmutableMap.Builder<String, String>()
|
||||
.putAll(parentOptions);
|
||||
|
||||
builder.put(CodegenConstants.IMPL_FOLDER, IMPL_FOLDER_VALUE);
|
||||
builder.put("title", "Test title");
|
||||
|
||||
builder.put(JavaCXFServerCodegen.USE_BEANVALIDATION, JavaOptionsProvider.USE_BEANVALIDATION);
|
||||
builder.put(JavaCXFServerCodegen.GENERATE_SPRING_APPLICATION, GENERATE_SPRING_APPLICATION);
|
||||
builder.put(JavaCXFServerCodegen.USE_SWAGGER_FEATURE, USE_SWAGGER_FEATURE);
|
||||
builder.put(JavaCXFServerCodegen.USE_WADL_FEATURE, USE_WADL_FEATURE);
|
||||
builder.put(JavaCXFServerCodegen.USE_MULTIPART_FEATURE, USE_MULTIPART_FEATURE);
|
||||
builder.put(JavaCXFServerCodegen.USE_GZIP_FEATURE, USE_GZIP_FEATURE);
|
||||
builder.put(JavaCXFServerCodegen.USE_LOGGING_FEATURE, USE_LOGGING_FEATURE);
|
||||
builder.put(JavaCXFServerCodegen.USE_BEANVALIDATION_FEATURE, USE_BEANVALIDATION_FEATURE);
|
||||
|
||||
builder.put(JavaCXFServerCodegen.GENERATE_SPRING_BOOT_APPLICATION, GENERATE_SPRING_BOOT_APPLICATION);
|
||||
|
||||
return builder.build();
|
||||
|
||||
}
|
||||
}
|
||||
package io.swagger.codegen.options;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
|
||||
import io.swagger.codegen.CodegenConstants;
|
||||
import io.swagger.codegen.languages.JavaCXFServerCodegen;
|
||||
|
||||
public class JavaCXFServerOptionsProvider extends JavaOptionsProvider {
|
||||
|
||||
public static final String USE_JAXB_ANNOTATIONS = "true";
|
||||
|
||||
public static final String GENERATE_SPRING_APPLICATION = "true";
|
||||
|
||||
public static final String USE_SWAGGER_FEATURE = "true";
|
||||
|
||||
public static final String USE_SWAGGER_UI = "true";
|
||||
|
||||
public static final String USE_WADL_FEATURE = "true";
|
||||
|
||||
public static final String USE_MULTIPART_FEATURE = "true";
|
||||
|
||||
public static final String USE_GZIP_FEATURE = "true";
|
||||
|
||||
public static final String USE_GZIP_FEATURE_FOR_TESTS = "true";
|
||||
|
||||
public static final String USE_LOGGING_FEATURE = "true";
|
||||
|
||||
public static final String USE_LOGGING_FEATURE_FOR_TESTS = "true";
|
||||
|
||||
public static final String USE_BEANVALIDATION_FEATURE = "true";
|
||||
|
||||
public static final String USE_SPRING_ANNOTATION_CONFIG = "true";
|
||||
|
||||
public static final String GENERATE_SPRING_BOOT_APPLICATION = "true";
|
||||
|
||||
public static final String GENERATE_JBOSS_DEPLOYMENT_DESCRIPTOR = "true";
|
||||
|
||||
public static final String ADD_CONSUMES_PRODUCES_JSON = "true";
|
||||
|
||||
public static final String IMPL_FOLDER_VALUE = "src/main/java";
|
||||
|
||||
@Override
|
||||
public boolean isServer() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getLanguage() {
|
||||
return "jaxrs-cxf";
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, String> createOptions() {
|
||||
|
||||
Map<String, String> parentOptions = super.createOptions();
|
||||
|
||||
ImmutableMap.Builder<String, String> builder = new ImmutableMap.Builder<String, String>()
|
||||
.putAll(parentOptions);
|
||||
|
||||
builder.put(CodegenConstants.IMPL_FOLDER, IMPL_FOLDER_VALUE);
|
||||
builder.put("title", "Test title");
|
||||
|
||||
builder.put(JavaCXFServerCodegen.USE_BEANVALIDATION, JavaOptionsProvider.USE_BEANVALIDATION);
|
||||
builder.put(JavaCXFServerCodegen.USE_JAXB_ANNOTATIONS, USE_JAXB_ANNOTATIONS);
|
||||
|
||||
builder.put(JavaCXFServerCodegen.GENERATE_SPRING_APPLICATION, GENERATE_SPRING_APPLICATION);
|
||||
builder.put(JavaCXFServerCodegen.USE_SPRING_ANNOTATION_CONFIG, USE_SPRING_ANNOTATION_CONFIG);
|
||||
|
||||
builder.put(JavaCXFServerCodegen.USE_SWAGGER_FEATURE, USE_SWAGGER_FEATURE);
|
||||
builder.put(JavaCXFServerCodegen.USE_SWAGGER_UI, USE_SWAGGER_UI);
|
||||
|
||||
builder.put(JavaCXFServerCodegen.USE_WADL_FEATURE, USE_WADL_FEATURE);
|
||||
builder.put(JavaCXFServerCodegen.USE_MULTIPART_FEATURE, USE_MULTIPART_FEATURE);
|
||||
builder.put(JavaCXFServerCodegen.USE_GZIP_FEATURE, USE_GZIP_FEATURE);
|
||||
builder.put(JavaCXFServerCodegen.USE_GZIP_FEATURE_FOR_TESTS, USE_GZIP_FEATURE_FOR_TESTS);
|
||||
builder.put(JavaCXFServerCodegen.USE_LOGGING_FEATURE, USE_LOGGING_FEATURE);
|
||||
builder.put(JavaCXFServerCodegen.USE_LOGGING_FEATURE_FOR_TESTS, USE_LOGGING_FEATURE_FOR_TESTS);
|
||||
builder.put(JavaCXFServerCodegen.USE_BEANVALIDATION_FEATURE, USE_BEANVALIDATION_FEATURE);
|
||||
|
||||
builder.put(JavaCXFServerCodegen.GENERATE_SPRING_BOOT_APPLICATION, GENERATE_SPRING_BOOT_APPLICATION);
|
||||
|
||||
builder.put(JavaCXFServerCodegen.GENERATE_JBOSS_DEPLOYMENT_DESCRIPTOR, GENERATE_JBOSS_DEPLOYMENT_DESCRIPTOR);
|
||||
|
||||
builder.put(JavaCXFServerCodegen.ADD_CONSUMES_PRODUCES_JSON, ADD_CONSUMES_PRODUCES_JSON);
|
||||
|
||||
return builder.build();
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,42 @@
|
||||
package io.swagger.codegen.options;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
|
||||
import io.swagger.codegen.CodegenConstants;
|
||||
import io.swagger.codegen.languages.JavaCXFServerCodegen;
|
||||
|
||||
public class JavaResteasyServerOptionsProvider extends JavaOptionsProvider {
|
||||
|
||||
public static final String GENERATE_JBOSS_DEPLOYMENT_DESCRIPTOR = "true";
|
||||
|
||||
public static final String IMPL_FOLDER_VALUE = "src/main/java";
|
||||
|
||||
@Override
|
||||
public boolean isServer() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getLanguage() {
|
||||
return "jaxrs-resteasy";
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, String> createOptions() {
|
||||
|
||||
Map<String, String> parentOptions = super.createOptions();
|
||||
|
||||
ImmutableMap.Builder<String, String> builder = new ImmutableMap.Builder<String, String>()
|
||||
.putAll(parentOptions);
|
||||
|
||||
builder.put(CodegenConstants.IMPL_FOLDER, IMPL_FOLDER_VALUE);
|
||||
builder.put("title", "Test title");
|
||||
|
||||
builder.put(JavaCXFServerCodegen.GENERATE_JBOSS_DEPLOYMENT_DESCRIPTOR, GENERATE_JBOSS_DEPLOYMENT_DESCRIPTOR);
|
||||
|
||||
return builder.build();
|
||||
|
||||
}
|
||||
}
|
@ -1074,6 +1074,9 @@ definitions:
|
||||
enum:
|
||||
- 1.1
|
||||
- -1.2
|
||||
outerEnum:
|
||||
type: string
|
||||
$ref: '#/definitions/OuterEnum'
|
||||
AdditionalPropertiesClass:
|
||||
type: object
|
||||
properties:
|
||||
@ -1228,6 +1231,12 @@ definitions:
|
||||
# enum:
|
||||
# - Cat
|
||||
# - Dog
|
||||
OuterEnum:
|
||||
type: "string"
|
||||
enum:
|
||||
- "placed"
|
||||
- "approved"
|
||||
- "delivered"
|
||||
externalDocs:
|
||||
description: Find out more about Swagger
|
||||
url: 'http://swagger.io'
|
||||
|
23
samples/client/petstore/jaxrs-cxf/.swagger-codegen-ignore
Normal file
23
samples/client/petstore/jaxrs-cxf/.swagger-codegen-ignore
Normal file
@ -0,0 +1,23 @@
|
||||
# Swagger Codegen Ignore
|
||||
# Generated by swagger-codegen https://github.com/swagger-api/swagger-codegen
|
||||
|
||||
# Use this file to prevent files from being overwritten by the generator.
|
||||
# The patterns follow closely to .gitignore or .dockerignore.
|
||||
|
||||
# As an example, the C# client generator defines ApiClient.cs.
|
||||
# You can make changes and tell Swagger Codgen to ignore just this file by uncommenting the following line:
|
||||
#ApiClient.cs
|
||||
|
||||
# You can match any string of characters against a directory, file or extension with a single asterisk (*):
|
||||
#foo/*/qux
|
||||
# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux
|
||||
|
||||
# You can recursively match patterns against a directory, file or extension with a double asterisk (**):
|
||||
#foo/**/qux
|
||||
# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux
|
||||
|
||||
# You can also negate patterns with an exclamation (!).
|
||||
# For example, you can ignore all files in a docs folder with the file extension .md:
|
||||
#docs/*.md
|
||||
# Then explicitly reverse the ignore rule for a single file:
|
||||
#!docs/README.md
|
201
samples/client/petstore/jaxrs-cxf/LICENSE
Normal file
201
samples/client/petstore/jaxrs-cxf/LICENSE
Normal file
@ -0,0 +1,201 @@
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "{}"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright {yyyy} {name of copyright owner}
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
162
samples/client/petstore/jaxrs-cxf/pom.xml
Normal file
162
samples/client/petstore/jaxrs-cxf/pom.xml
Normal file
@ -0,0 +1,162 @@
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>io.swagger</groupId>
|
||||
<artifactId>swagger-jaxrs-client</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<name>swagger-jaxrs-client</name>
|
||||
<version>1.0.0</version>
|
||||
<build>
|
||||
<sourceDirectory>src/main/java</sourceDirectory>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-failsafe-plugin</artifactId>
|
||||
<version>2.6</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>integration-test</goal>
|
||||
<goal>verify</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<!--plugin>
|
||||
<groupId>org.eclipse.jetty</groupId>
|
||||
<artifactId>jetty-maven-plugin</artifactId>
|
||||
<version>${jetty-version}</version>
|
||||
<configuration>
|
||||
<webApp>
|
||||
<contextPath>/</contextPath>
|
||||
</webApp>
|
||||
<webAppSourceDirectory>target/${project.artifactId}-${project.version}</webAppSourceDirectory>
|
||||
<stopPort>8079</stopPort>
|
||||
<stopKey>stopit</stopKey>
|
||||
<httpConnector>
|
||||
<port></port>
|
||||
<idleTimeout>60000</idleTimeout>
|
||||
</httpConnector>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>start-jetty</id>
|
||||
<phase>pre-integration-test</phase>
|
||||
<goals>
|
||||
<goal>start</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<scanIntervalSeconds>0</scanIntervalSeconds>
|
||||
<daemon>true</daemon>
|
||||
</configuration>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>stop-jetty</id>
|
||||
<phase>post-integration-test</phase>
|
||||
<goals>
|
||||
<goal>stop</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin-->
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>build-helper-maven-plugin</artifactId>
|
||||
<version>1.9.1</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>add-source</id>
|
||||
<phase>generate-sources</phase>
|
||||
<goals>
|
||||
<goal>add-source</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<sources>
|
||||
<source>src/gen/java</source>
|
||||
</sources>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>io.swagger</groupId>
|
||||
<artifactId>swagger-jaxrs</artifactId>
|
||||
<scope>compile</scope>
|
||||
<version>${swagger-core-version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ch.qos.logback</groupId>
|
||||
<artifactId>logback-classic</artifactId>
|
||||
<version>${logback-version}</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ch.qos.logback</groupId>
|
||||
<artifactId>logback-core</artifactId>
|
||||
<version>${logback-version}</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>${junit-version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<!-- CXF Client -->
|
||||
<dependency>
|
||||
<groupId>org.apache.cxf</groupId>
|
||||
<artifactId>cxf-rt-rs-client</artifactId>
|
||||
<version>${cxf-version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- CXF server -->
|
||||
<dependency>
|
||||
<groupId>org.apache.cxf</groupId>
|
||||
<artifactId>cxf-rt-frontend-jaxrs</artifactId>
|
||||
<version>${cxf-version}</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.cxf</groupId>
|
||||
<artifactId>cxf-rt-rs-service-description</artifactId>
|
||||
<version>${cxf-version}</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.cxf</groupId>
|
||||
<artifactId>cxf-rt-ws-policy</artifactId>
|
||||
<version>${cxf-version}</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.cxf</groupId>
|
||||
<artifactId>cxf-rt-wsdl</artifactId>
|
||||
<version>${cxf-version}</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>sonatype-snapshots</id>
|
||||
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
|
||||
<snapshots>
|
||||
<enabled>true</enabled>
|
||||
</snapshots>
|
||||
</repository>
|
||||
</repositories>
|
||||
<properties>
|
||||
<java.version>1.7</java.version>
|
||||
<maven.compiler.source>${java.version}</maven.compiler.source>
|
||||
<maven.compiler.target>${java.version}</maven.compiler.target>
|
||||
<swagger-core-version>1.5.9</swagger-core-version>
|
||||
<jetty-version>9.2.9.v20150224</jetty-version>
|
||||
<jersey2-version>2.22.2</jersey2-version>
|
||||
<junit-version>4.12</junit-version>
|
||||
<logback-version>1.1.7</logback-version>
|
||||
<servlet-api-version>2.5</servlet-api-version>
|
||||
<cxf-version>3.1.6</cxf-version>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
</project>
|
@ -0,0 +1,78 @@
|
||||
package io.swagger.api;
|
||||
|
||||
import io.swagger.model.Pet;
|
||||
import io.swagger.model.ModelApiResponse;
|
||||
import java.io.File;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import javax.ws.rs.*;
|
||||
import javax.ws.rs.core.Response;
|
||||
import javax.ws.rs.core.MediaType;
|
||||
import org.apache.cxf.jaxrs.ext.multipart.*;
|
||||
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
|
||||
@Path("/")
|
||||
@Api(value = "/", description = "")
|
||||
@Consumes(MediaType.APPLICATION_JSON)
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public interface PetApi {
|
||||
|
||||
@POST
|
||||
@Path("/pet")
|
||||
@Consumes({ "application/json", "application/xml" })
|
||||
@Produces({ "application/xml", "application/json" })
|
||||
@ApiOperation(value = "Add a new pet to the store", tags={ })
|
||||
public void addPet(Pet body);
|
||||
|
||||
@DELETE
|
||||
@Path("/pet/{petId}")
|
||||
@Produces({ "application/xml", "application/json" })
|
||||
@ApiOperation(value = "Deletes a pet", tags={ })
|
||||
public void deletePet(@PathParam("petId") Long petId, @HeaderParam("api_key") String apiKey);
|
||||
|
||||
@GET
|
||||
@Path("/pet/findByStatus")
|
||||
@Produces({ "application/xml", "application/json" })
|
||||
@ApiOperation(value = "Finds Pets by status", tags={ })
|
||||
public List<Pet> findPetsByStatus(@QueryParam("status")List<String> status);
|
||||
|
||||
@GET
|
||||
@Path("/pet/findByTags")
|
||||
@Produces({ "application/xml", "application/json" })
|
||||
@ApiOperation(value = "Finds Pets by tags", tags={ })
|
||||
public List<Pet> findPetsByTags(@QueryParam("tags")List<String> tags);
|
||||
|
||||
@GET
|
||||
@Path("/pet/{petId}")
|
||||
@Produces({ "application/xml", "application/json" })
|
||||
@ApiOperation(value = "Find pet by ID", tags={ })
|
||||
public Pet getPetById(@PathParam("petId") Long petId);
|
||||
|
||||
@PUT
|
||||
@Path("/pet")
|
||||
@Consumes({ "application/json", "application/xml" })
|
||||
@Produces({ "application/xml", "application/json" })
|
||||
@ApiOperation(value = "Update an existing pet", tags={ })
|
||||
public void updatePet(Pet body);
|
||||
|
||||
@POST
|
||||
@Path("/pet/{petId}")
|
||||
@Consumes({ "application/x-www-form-urlencoded" })
|
||||
@Produces({ "application/xml", "application/json" })
|
||||
@ApiOperation(value = "Updates a pet in the store with form data", tags={ })
|
||||
public void updatePetWithForm(@PathParam("petId") Long petId, @Multipart(value = "name", required = false) String name, @Multipart(value = "status", required = false) String status);
|
||||
|
||||
@POST
|
||||
@Path("/pet/{petId}/uploadImage")
|
||||
@Consumes({ "multipart/form-data" })
|
||||
@Produces({ "application/json" })
|
||||
@ApiOperation(value = "uploads an image", tags={ })
|
||||
public ModelApiResponse uploadFile(@PathParam("petId") Long petId, @Multipart(value = "additionalMetadata", required = false) String additionalMetadata, @Multipart(value = "file", required = false) InputStream fileInputStream,
|
||||
@Multipart(value = "file" , required = false) Attachment fileDetail);
|
||||
}
|
||||
|
@ -0,0 +1,47 @@
|
||||
package io.swagger.api;
|
||||
|
||||
import io.swagger.model.Order;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import javax.ws.rs.*;
|
||||
import javax.ws.rs.core.Response;
|
||||
import javax.ws.rs.core.MediaType;
|
||||
import org.apache.cxf.jaxrs.ext.multipart.*;
|
||||
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
|
||||
@Path("/")
|
||||
@Api(value = "/", description = "")
|
||||
@Consumes(MediaType.APPLICATION_JSON)
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public interface StoreApi {
|
||||
|
||||
@DELETE
|
||||
@Path("/store/order/{orderId}")
|
||||
@Produces({ "application/xml", "application/json" })
|
||||
@ApiOperation(value = "Delete purchase order by ID", tags={ })
|
||||
public void deleteOrder(@PathParam("orderId") String orderId);
|
||||
|
||||
@GET
|
||||
@Path("/store/inventory")
|
||||
@Produces({ "application/json" })
|
||||
@ApiOperation(value = "Returns pet inventories by status", tags={ })
|
||||
public Map<String, Integer> getInventory();
|
||||
|
||||
@GET
|
||||
@Path("/store/order/{orderId}")
|
||||
@Produces({ "application/xml", "application/json" })
|
||||
@ApiOperation(value = "Find purchase order by ID", tags={ })
|
||||
public Order getOrderById(@PathParam("orderId") Long orderId);
|
||||
|
||||
@POST
|
||||
@Path("/store/order")
|
||||
@Produces({ "application/xml", "application/json" })
|
||||
@ApiOperation(value = "Place an order for a pet", tags={ })
|
||||
public Order placeOrder(Order body);
|
||||
}
|
||||
|
@ -0,0 +1,71 @@
|
||||
package io.swagger.api;
|
||||
|
||||
import io.swagger.model.User;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import javax.ws.rs.*;
|
||||
import javax.ws.rs.core.Response;
|
||||
import javax.ws.rs.core.MediaType;
|
||||
import org.apache.cxf.jaxrs.ext.multipart.*;
|
||||
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
|
||||
@Path("/")
|
||||
@Api(value = "/", description = "")
|
||||
@Consumes(MediaType.APPLICATION_JSON)
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public interface UserApi {
|
||||
|
||||
@POST
|
||||
@Path("/user")
|
||||
@Produces({ "application/xml", "application/json" })
|
||||
@ApiOperation(value = "Create user", tags={ })
|
||||
public void createUser(User body);
|
||||
|
||||
@POST
|
||||
@Path("/user/createWithArray")
|
||||
@Produces({ "application/xml", "application/json" })
|
||||
@ApiOperation(value = "Creates list of users with given input array", tags={ })
|
||||
public void createUsersWithArrayInput(List<User> body);
|
||||
|
||||
@POST
|
||||
@Path("/user/createWithList")
|
||||
@Produces({ "application/xml", "application/json" })
|
||||
@ApiOperation(value = "Creates list of users with given input array", tags={ })
|
||||
public void createUsersWithListInput(List<User> body);
|
||||
|
||||
@DELETE
|
||||
@Path("/user/{username}")
|
||||
@Produces({ "application/xml", "application/json" })
|
||||
@ApiOperation(value = "Delete user", tags={ })
|
||||
public void deleteUser(@PathParam("username") String username);
|
||||
|
||||
@GET
|
||||
@Path("/user/{username}")
|
||||
@Produces({ "application/xml", "application/json" })
|
||||
@ApiOperation(value = "Get user by user name", tags={ })
|
||||
public User getUserByName(@PathParam("username") String username);
|
||||
|
||||
@GET
|
||||
@Path("/user/login")
|
||||
@Produces({ "application/xml", "application/json" })
|
||||
@ApiOperation(value = "Logs user into the system", tags={ })
|
||||
public String loginUser(@QueryParam("username")String username, @QueryParam("password")String password);
|
||||
|
||||
@GET
|
||||
@Path("/user/logout")
|
||||
@Produces({ "application/xml", "application/json" })
|
||||
@ApiOperation(value = "Logs out current logged in user session", tags={ })
|
||||
public void logoutUser();
|
||||
|
||||
@PUT
|
||||
@Path("/user/{username}")
|
||||
@Produces({ "application/xml", "application/json" })
|
||||
@ApiOperation(value = "Updated user", tags={ })
|
||||
public void updateUser(@PathParam("username") String username, User body);
|
||||
}
|
||||
|
@ -2,6 +2,7 @@ package io.swagger.model;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
@ -10,33 +11,28 @@ import javax.xml.bind.annotation.XmlType;
|
||||
import javax.xml.bind.annotation.XmlEnum;
|
||||
import javax.xml.bind.annotation.XmlEnumValue;
|
||||
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
@XmlType(name = "Category", propOrder =
|
||||
{ "id", "name"
|
||||
})
|
||||
|
||||
@XmlRootElement(name="Category")
|
||||
@ApiModel(description="A category for a pet")
|
||||
public class Category {
|
||||
|
||||
|
||||
@XmlElement(name="id")
|
||||
@ApiModelProperty(example = "null", value = "")
|
||||
private Long id = null;
|
||||
|
||||
@XmlElement(name="name")
|
||||
@ApiModelProperty(example = "null", value = "")
|
||||
private String name = null;
|
||||
|
||||
/**
|
||||
**/
|
||||
|
||||
/**
|
||||
* Get id
|
||||
* @return id
|
||||
**/
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
/**
|
||||
**/
|
||||
|
||||
/**
|
||||
* Get name
|
||||
* @return name
|
||||
**/
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
@ -2,6 +2,7 @@ package io.swagger.model;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
@ -10,45 +11,40 @@ import javax.xml.bind.annotation.XmlType;
|
||||
import javax.xml.bind.annotation.XmlEnum;
|
||||
import javax.xml.bind.annotation.XmlEnumValue;
|
||||
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
@XmlType(name = "ModelApiResponse", propOrder =
|
||||
{ "code", "type", "message"
|
||||
})
|
||||
|
||||
@XmlRootElement(name="ModelApiResponse")
|
||||
@ApiModel(description="Describes the result of uploading an image resource")
|
||||
public class ModelApiResponse {
|
||||
|
||||
|
||||
@XmlElement(name="code")
|
||||
@ApiModelProperty(example = "null", value = "")
|
||||
private Integer code = null;
|
||||
|
||||
@XmlElement(name="type")
|
||||
@ApiModelProperty(example = "null", value = "")
|
||||
private String type = null;
|
||||
|
||||
@XmlElement(name="message")
|
||||
@ApiModelProperty(example = "null", value = "")
|
||||
private String message = null;
|
||||
|
||||
/**
|
||||
**/
|
||||
|
||||
/**
|
||||
* Get code
|
||||
* @return code
|
||||
**/
|
||||
public Integer getCode() {
|
||||
return code;
|
||||
}
|
||||
public void setCode(Integer code) {
|
||||
this.code = code;
|
||||
}
|
||||
/**
|
||||
**/
|
||||
|
||||
/**
|
||||
* Get type
|
||||
* @return type
|
||||
**/
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
/**
|
||||
**/
|
||||
|
||||
/**
|
||||
* Get message
|
||||
* @return message
|
||||
**/
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
@ -2,6 +2,7 @@ package io.swagger.model;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
@ -10,25 +11,16 @@ import javax.xml.bind.annotation.XmlType;
|
||||
import javax.xml.bind.annotation.XmlEnum;
|
||||
import javax.xml.bind.annotation.XmlEnumValue;
|
||||
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
@XmlType(name = "Order", propOrder =
|
||||
{ "id", "petId", "quantity", "shipDate", "status", "complete"
|
||||
})
|
||||
|
||||
@XmlRootElement(name="Order")
|
||||
@ApiModel(description="An order for a pets from the pet store")
|
||||
public class Order {
|
||||
|
||||
|
||||
@XmlElement(name="id")
|
||||
@ApiModelProperty(example = "null", value = "")
|
||||
private Long id = null;
|
||||
|
||||
@XmlElement(name="petId")
|
||||
@ApiModelProperty(example = "null", value = "")
|
||||
private Long petId = null;
|
||||
|
||||
@XmlElement(name="quantity")
|
||||
@ApiModelProperty(example = "null", value = "")
|
||||
private Integer quantity = null;
|
||||
|
||||
@XmlElement(name="shipDate")
|
||||
@ApiModelProperty(example = "null", value = "")
|
||||
private javax.xml.datatype.XMLGregorianCalendar shipDate = null;
|
||||
|
||||
@XmlType(name="StatusEnum")
|
||||
@ -63,62 +55,65 @@ public enum StatusEnum {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@XmlElement(name="status")
|
||||
@ApiModelProperty(example = "null", value = "Order Status")
|
||||
private StatusEnum status = null;
|
||||
|
||||
@XmlElement(name="complete")
|
||||
@ApiModelProperty(example = "null", value = "")
|
||||
private Boolean complete = false;
|
||||
|
||||
/**
|
||||
**/
|
||||
|
||||
/**
|
||||
* Get id
|
||||
* @return id
|
||||
**/
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
/**
|
||||
**/
|
||||
|
||||
/**
|
||||
* Get petId
|
||||
* @return petId
|
||||
**/
|
||||
public Long getPetId() {
|
||||
return petId;
|
||||
}
|
||||
public void setPetId(Long petId) {
|
||||
this.petId = petId;
|
||||
}
|
||||
/**
|
||||
**/
|
||||
|
||||
/**
|
||||
* Get quantity
|
||||
* @return quantity
|
||||
**/
|
||||
public Integer getQuantity() {
|
||||
return quantity;
|
||||
}
|
||||
public void setQuantity(Integer quantity) {
|
||||
this.quantity = quantity;
|
||||
}
|
||||
/**
|
||||
**/
|
||||
|
||||
/**
|
||||
* Get shipDate
|
||||
* @return shipDate
|
||||
**/
|
||||
public javax.xml.datatype.XMLGregorianCalendar getShipDate() {
|
||||
return shipDate;
|
||||
}
|
||||
public void setShipDate(javax.xml.datatype.XMLGregorianCalendar shipDate) {
|
||||
this.shipDate = shipDate;
|
||||
}
|
||||
/**
|
||||
/**
|
||||
* Order Status
|
||||
**/
|
||||
|
||||
* @return status
|
||||
**/
|
||||
public StatusEnum getStatus() {
|
||||
return status;
|
||||
}
|
||||
public void setStatus(StatusEnum status) {
|
||||
this.status = status;
|
||||
}
|
||||
/**
|
||||
**/
|
||||
|
||||
/**
|
||||
* Get complete
|
||||
* @return complete
|
||||
**/
|
||||
public Boolean getComplete() {
|
||||
return complete;
|
||||
}
|
@ -6,6 +6,7 @@ import io.swagger.model.Tag;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
@ -14,28 +15,18 @@ import javax.xml.bind.annotation.XmlType;
|
||||
import javax.xml.bind.annotation.XmlEnum;
|
||||
import javax.xml.bind.annotation.XmlEnumValue;
|
||||
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
@XmlType(name = "Pet", propOrder =
|
||||
{ "id", "category", "name", "photoUrls", "tags", "status"
|
||||
})
|
||||
|
||||
@XmlRootElement(name="Pet")
|
||||
@ApiModel(description="A pet for sale in the pet store")
|
||||
public class Pet {
|
||||
|
||||
|
||||
@XmlElement(name="id")
|
||||
@ApiModelProperty(example = "null", value = "")
|
||||
private Long id = null;
|
||||
|
||||
@XmlElement(name="category")
|
||||
@ApiModelProperty(example = "null", value = "")
|
||||
private Category category = null;
|
||||
|
||||
@XmlElement(name="name")
|
||||
@ApiModelProperty(example = "doggie", required = true, value = "")
|
||||
private String name = null;
|
||||
|
||||
@XmlElement(name="photoUrls")
|
||||
@ApiModelProperty(example = "null", required = true, value = "")
|
||||
private List<String> photoUrls = new ArrayList<String>();
|
||||
|
||||
@XmlElement(name="tags")
|
||||
@ApiModelProperty(example = "null", value = "")
|
||||
private List<Tag> tags = new ArrayList<Tag>();
|
||||
|
||||
@XmlType(name="StatusEnum")
|
||||
@ -70,59 +61,63 @@ public enum StatusEnum {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@XmlElement(name="status")
|
||||
@ApiModelProperty(example = "null", value = "pet status in the store")
|
||||
private StatusEnum status = null;
|
||||
|
||||
/**
|
||||
**/
|
||||
|
||||
/**
|
||||
* Get id
|
||||
* @return id
|
||||
**/
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
/**
|
||||
**/
|
||||
|
||||
/**
|
||||
* Get category
|
||||
* @return category
|
||||
**/
|
||||
public Category getCategory() {
|
||||
return category;
|
||||
}
|
||||
public void setCategory(Category category) {
|
||||
this.category = category;
|
||||
}
|
||||
/**
|
||||
**/
|
||||
|
||||
/**
|
||||
* Get name
|
||||
* @return name
|
||||
**/
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
/**
|
||||
**/
|
||||
|
||||
/**
|
||||
* Get photoUrls
|
||||
* @return photoUrls
|
||||
**/
|
||||
public List<String> getPhotoUrls() {
|
||||
return photoUrls;
|
||||
}
|
||||
public void setPhotoUrls(List<String> photoUrls) {
|
||||
this.photoUrls = photoUrls;
|
||||
}
|
||||
/**
|
||||
**/
|
||||
|
||||
/**
|
||||
* Get tags
|
||||
* @return tags
|
||||
**/
|
||||
public List<Tag> getTags() {
|
||||
return tags;
|
||||
}
|
||||
public void setTags(List<Tag> tags) {
|
||||
this.tags = tags;
|
||||
}
|
||||
/**
|
||||
/**
|
||||
* pet status in the store
|
||||
**/
|
||||
|
||||
* @return status
|
||||
**/
|
||||
public StatusEnum getStatus() {
|
||||
return status;
|
||||
}
|
@ -2,6 +2,7 @@ package io.swagger.model;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
@ -10,33 +11,28 @@ import javax.xml.bind.annotation.XmlType;
|
||||
import javax.xml.bind.annotation.XmlEnum;
|
||||
import javax.xml.bind.annotation.XmlEnumValue;
|
||||
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
@XmlType(name = "Tag", propOrder =
|
||||
{ "id", "name"
|
||||
})
|
||||
|
||||
@XmlRootElement(name="Tag")
|
||||
@ApiModel(description="A tag for a pet")
|
||||
public class Tag {
|
||||
|
||||
|
||||
@XmlElement(name="id")
|
||||
@ApiModelProperty(example = "null", value = "")
|
||||
private Long id = null;
|
||||
|
||||
@XmlElement(name="name")
|
||||
@ApiModelProperty(example = "null", value = "")
|
||||
private String name = null;
|
||||
|
||||
/**
|
||||
**/
|
||||
|
||||
/**
|
||||
* Get id
|
||||
* @return id
|
||||
**/
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
/**
|
||||
**/
|
||||
|
||||
/**
|
||||
* Get name
|
||||
* @return name
|
||||
**/
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
@ -2,6 +2,7 @@ package io.swagger.model;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
@ -10,106 +11,100 @@ import javax.xml.bind.annotation.XmlType;
|
||||
import javax.xml.bind.annotation.XmlEnum;
|
||||
import javax.xml.bind.annotation.XmlEnumValue;
|
||||
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
@XmlType(name = "User", propOrder =
|
||||
{ "id", "username", "firstName", "lastName", "email", "password", "phone", "userStatus"
|
||||
})
|
||||
|
||||
@XmlRootElement(name="User")
|
||||
@ApiModel(description="A User who is purchasing from the pet store")
|
||||
public class User {
|
||||
|
||||
|
||||
@XmlElement(name="id")
|
||||
@ApiModelProperty(example = "null", value = "")
|
||||
private Long id = null;
|
||||
|
||||
@XmlElement(name="username")
|
||||
@ApiModelProperty(example = "null", value = "")
|
||||
private String username = null;
|
||||
|
||||
@XmlElement(name="firstName")
|
||||
@ApiModelProperty(example = "null", value = "")
|
||||
private String firstName = null;
|
||||
|
||||
@XmlElement(name="lastName")
|
||||
@ApiModelProperty(example = "null", value = "")
|
||||
private String lastName = null;
|
||||
|
||||
@XmlElement(name="email")
|
||||
@ApiModelProperty(example = "null", value = "")
|
||||
private String email = null;
|
||||
|
||||
@XmlElement(name="password")
|
||||
@ApiModelProperty(example = "null", value = "")
|
||||
private String password = null;
|
||||
|
||||
@XmlElement(name="phone")
|
||||
@ApiModelProperty(example = "null", value = "")
|
||||
private String phone = null;
|
||||
|
||||
@XmlElement(name="userStatus")
|
||||
@ApiModelProperty(example = "null", value = "User Status")
|
||||
private Integer userStatus = null;
|
||||
|
||||
/**
|
||||
**/
|
||||
|
||||
/**
|
||||
* Get id
|
||||
* @return id
|
||||
**/
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
/**
|
||||
**/
|
||||
|
||||
/**
|
||||
* Get username
|
||||
* @return username
|
||||
**/
|
||||
public String getUsername() {
|
||||
return username;
|
||||
}
|
||||
public void setUsername(String username) {
|
||||
this.username = username;
|
||||
}
|
||||
/**
|
||||
**/
|
||||
|
||||
/**
|
||||
* Get firstName
|
||||
* @return firstName
|
||||
**/
|
||||
public String getFirstName() {
|
||||
return firstName;
|
||||
}
|
||||
public void setFirstName(String firstName) {
|
||||
this.firstName = firstName;
|
||||
}
|
||||
/**
|
||||
**/
|
||||
|
||||
/**
|
||||
* Get lastName
|
||||
* @return lastName
|
||||
**/
|
||||
public String getLastName() {
|
||||
return lastName;
|
||||
}
|
||||
public void setLastName(String lastName) {
|
||||
this.lastName = lastName;
|
||||
}
|
||||
/**
|
||||
**/
|
||||
|
||||
/**
|
||||
* Get email
|
||||
* @return email
|
||||
**/
|
||||
public String getEmail() {
|
||||
return email;
|
||||
}
|
||||
public void setEmail(String email) {
|
||||
this.email = email;
|
||||
}
|
||||
/**
|
||||
**/
|
||||
|
||||
/**
|
||||
* Get password
|
||||
* @return password
|
||||
**/
|
||||
public String getPassword() {
|
||||
return password;
|
||||
}
|
||||
public void setPassword(String password) {
|
||||
this.password = password;
|
||||
}
|
||||
/**
|
||||
**/
|
||||
|
||||
/**
|
||||
* Get phone
|
||||
* @return phone
|
||||
**/
|
||||
public String getPhone() {
|
||||
return phone;
|
||||
}
|
||||
public void setPhone(String phone) {
|
||||
this.phone = phone;
|
||||
}
|
||||
/**
|
||||
/**
|
||||
* User Status
|
||||
**/
|
||||
|
||||
* @return userStatus
|
||||
**/
|
||||
public Integer getUserStatus() {
|
||||
return userStatus;
|
||||
}
|
@ -0,0 +1,205 @@
|
||||
/**
|
||||
* Swagger Petstore
|
||||
* This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.
|
||||
*
|
||||
* OpenAPI spec version: 1.0.0
|
||||
* Contact: apiteam@swagger.io
|
||||
*
|
||||
* NOTE: This class is auto generated by the swagger code generator program.
|
||||
* https://github.com/swagger-api/swagger-codegen.git
|
||||
* Do not edit the class manually.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
package io.swagger.api;
|
||||
|
||||
import io.swagger.model.Pet;
|
||||
import io.swagger.model.ModelApiResponse;
|
||||
import java.io.File;
|
||||
import org.junit.Test;
|
||||
import org.junit.Before;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
import javax.ws.rs.core.Response;
|
||||
import org.apache.cxf.jaxrs.client.JAXRSClientFactory;
|
||||
import org.apache.cxf.jaxrs.client.ClientConfiguration;
|
||||
import org.apache.cxf.jaxrs.client.WebClient;
|
||||
|
||||
|
||||
import com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* API tests for PetApi
|
||||
*/
|
||||
public class PetApiTest {
|
||||
|
||||
|
||||
private PetApi api;
|
||||
|
||||
@Before
|
||||
public void setup() {
|
||||
JacksonJsonProvider provider = new JacksonJsonProvider();
|
||||
List providers = new ArrayList();
|
||||
providers.add(provider);
|
||||
|
||||
api = JAXRSClientFactory.create("http://petstore.swagger.io/v2", PetApi.class, providers);
|
||||
org.apache.cxf.jaxrs.client.Client client = WebClient.client(api);
|
||||
|
||||
ClientConfiguration config = WebClient.getConfig(client);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Add a new pet to the store
|
||||
*
|
||||
*
|
||||
*
|
||||
* @throws ApiException
|
||||
* if the Api call fails
|
||||
*/
|
||||
@Test
|
||||
public void addPetTest() {
|
||||
Pet body = null;
|
||||
// response = api.addPet(body);
|
||||
//assertNotNull(response);
|
||||
// TODO: test validations
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes a pet
|
||||
*
|
||||
*
|
||||
*
|
||||
* @throws ApiException
|
||||
* if the Api call fails
|
||||
*/
|
||||
@Test
|
||||
public void deletePetTest() {
|
||||
Long petId = null;
|
||||
String apiKey = null;
|
||||
// response = api.deletePet(petId, apiKey);
|
||||
//assertNotNull(response);
|
||||
// TODO: test validations
|
||||
}
|
||||
|
||||
/**
|
||||
* Finds Pets by status
|
||||
*
|
||||
* Multiple status values can be provided with comma separated strings
|
||||
*
|
||||
* @throws ApiException
|
||||
* if the Api call fails
|
||||
*/
|
||||
@Test
|
||||
public void findPetsByStatusTest() {
|
||||
List<String> status = null;
|
||||
//List<Pet> response = api.findPetsByStatus(status);
|
||||
//assertNotNull(response);
|
||||
// TODO: test validations
|
||||
}
|
||||
|
||||
/**
|
||||
* Finds Pets by tags
|
||||
*
|
||||
* Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
|
||||
*
|
||||
* @throws ApiException
|
||||
* if the Api call fails
|
||||
*/
|
||||
@Test
|
||||
public void findPetsByTagsTest() {
|
||||
List<String> tags = null;
|
||||
//List<Pet> response = api.findPetsByTags(tags);
|
||||
//assertNotNull(response);
|
||||
// TODO: test validations
|
||||
}
|
||||
|
||||
/**
|
||||
* Find pet by ID
|
||||
*
|
||||
* Returns a single pet
|
||||
*
|
||||
* @throws ApiException
|
||||
* if the Api call fails
|
||||
*/
|
||||
@Test
|
||||
public void getPetByIdTest() {
|
||||
Long petId = null;
|
||||
//Pet response = api.getPetById(petId);
|
||||
//assertNotNull(response);
|
||||
// TODO: test validations
|
||||
}
|
||||
|
||||
/**
|
||||
* Update an existing pet
|
||||
*
|
||||
*
|
||||
*
|
||||
* @throws ApiException
|
||||
* if the Api call fails
|
||||
*/
|
||||
@Test
|
||||
public void updatePetTest() {
|
||||
Pet body = null;
|
||||
// response = api.updatePet(body);
|
||||
//assertNotNull(response);
|
||||
// TODO: test validations
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates a pet in the store with form data
|
||||
*
|
||||
*
|
||||
*
|
||||
* @throws ApiException
|
||||
* if the Api call fails
|
||||
*/
|
||||
@Test
|
||||
public void updatePetWithFormTest() {
|
||||
Long petId = null;
|
||||
String name = null;
|
||||
String status = null;
|
||||
// response = api.updatePetWithForm(petId, name, status);
|
||||
//assertNotNull(response);
|
||||
// TODO: test validations
|
||||
}
|
||||
|
||||
/**
|
||||
* uploads an image
|
||||
*
|
||||
*
|
||||
*
|
||||
* @throws ApiException
|
||||
* if the Api call fails
|
||||
*/
|
||||
@Test
|
||||
public void uploadFileTest() {
|
||||
Long petId = null;
|
||||
String additionalMetadata = null;
|
||||
File file = null;
|
||||
//ModelApiResponse response = api.uploadFile(petId, additionalMetadata, file);
|
||||
//assertNotNull(response);
|
||||
// TODO: test validations
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,133 @@
|
||||
/**
|
||||
* Swagger Petstore
|
||||
* This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.
|
||||
*
|
||||
* OpenAPI spec version: 1.0.0
|
||||
* Contact: apiteam@swagger.io
|
||||
*
|
||||
* NOTE: This class is auto generated by the swagger code generator program.
|
||||
* https://github.com/swagger-api/swagger-codegen.git
|
||||
* Do not edit the class manually.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
package io.swagger.api;
|
||||
|
||||
import io.swagger.model.Order;
|
||||
import org.junit.Test;
|
||||
import org.junit.Before;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
import javax.ws.rs.core.Response;
|
||||
import org.apache.cxf.jaxrs.client.JAXRSClientFactory;
|
||||
import org.apache.cxf.jaxrs.client.ClientConfiguration;
|
||||
import org.apache.cxf.jaxrs.client.WebClient;
|
||||
|
||||
|
||||
import com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* API tests for StoreApi
|
||||
*/
|
||||
public class StoreApiTest {
|
||||
|
||||
|
||||
private StoreApi api;
|
||||
|
||||
@Before
|
||||
public void setup() {
|
||||
JacksonJsonProvider provider = new JacksonJsonProvider();
|
||||
List providers = new ArrayList();
|
||||
providers.add(provider);
|
||||
|
||||
api = JAXRSClientFactory.create("http://petstore.swagger.io/v2", StoreApi.class, providers);
|
||||
org.apache.cxf.jaxrs.client.Client client = WebClient.client(api);
|
||||
|
||||
ClientConfiguration config = WebClient.getConfig(client);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Delete purchase order by ID
|
||||
*
|
||||
* For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
|
||||
*
|
||||
* @throws ApiException
|
||||
* if the Api call fails
|
||||
*/
|
||||
@Test
|
||||
public void deleteOrderTest() {
|
||||
String orderId = null;
|
||||
// response = api.deleteOrder(orderId);
|
||||
//assertNotNull(response);
|
||||
// TODO: test validations
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns pet inventories by status
|
||||
*
|
||||
* Returns a map of status codes to quantities
|
||||
*
|
||||
* @throws ApiException
|
||||
* if the Api call fails
|
||||
*/
|
||||
@Test
|
||||
public void getInventoryTest() {
|
||||
//Map<String, Integer> response = api.getInventory();
|
||||
//assertNotNull(response);
|
||||
// TODO: test validations
|
||||
}
|
||||
|
||||
/**
|
||||
* Find purchase order by ID
|
||||
*
|
||||
* For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions
|
||||
*
|
||||
* @throws ApiException
|
||||
* if the Api call fails
|
||||
*/
|
||||
@Test
|
||||
public void getOrderByIdTest() {
|
||||
Long orderId = null;
|
||||
//Order response = api.getOrderById(orderId);
|
||||
//assertNotNull(response);
|
||||
// TODO: test validations
|
||||
}
|
||||
|
||||
/**
|
||||
* Place an order for a pet
|
||||
*
|
||||
*
|
||||
*
|
||||
* @throws ApiException
|
||||
* if the Api call fails
|
||||
*/
|
||||
@Test
|
||||
public void placeOrderTest() {
|
||||
Order body = null;
|
||||
//Order response = api.placeOrder(body);
|
||||
//assertNotNull(response);
|
||||
// TODO: test validations
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,199 @@
|
||||
/**
|
||||
* Swagger Petstore
|
||||
* This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.
|
||||
*
|
||||
* OpenAPI spec version: 1.0.0
|
||||
* Contact: apiteam@swagger.io
|
||||
*
|
||||
* NOTE: This class is auto generated by the swagger code generator program.
|
||||
* https://github.com/swagger-api/swagger-codegen.git
|
||||
* Do not edit the class manually.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
package io.swagger.api;
|
||||
|
||||
import io.swagger.model.User;
|
||||
import org.junit.Test;
|
||||
import org.junit.Before;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
import javax.ws.rs.core.Response;
|
||||
import org.apache.cxf.jaxrs.client.JAXRSClientFactory;
|
||||
import org.apache.cxf.jaxrs.client.ClientConfiguration;
|
||||
import org.apache.cxf.jaxrs.client.WebClient;
|
||||
|
||||
|
||||
import com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* API tests for UserApi
|
||||
*/
|
||||
public class UserApiTest {
|
||||
|
||||
|
||||
private UserApi api;
|
||||
|
||||
@Before
|
||||
public void setup() {
|
||||
JacksonJsonProvider provider = new JacksonJsonProvider();
|
||||
List providers = new ArrayList();
|
||||
providers.add(provider);
|
||||
|
||||
api = JAXRSClientFactory.create("http://petstore.swagger.io/v2", UserApi.class, providers);
|
||||
org.apache.cxf.jaxrs.client.Client client = WebClient.client(api);
|
||||
|
||||
ClientConfiguration config = WebClient.getConfig(client);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Create user
|
||||
*
|
||||
* This can only be done by the logged in user.
|
||||
*
|
||||
* @throws ApiException
|
||||
* if the Api call fails
|
||||
*/
|
||||
@Test
|
||||
public void createUserTest() {
|
||||
User body = null;
|
||||
// response = api.createUser(body);
|
||||
//assertNotNull(response);
|
||||
// TODO: test validations
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates list of users with given input array
|
||||
*
|
||||
*
|
||||
*
|
||||
* @throws ApiException
|
||||
* if the Api call fails
|
||||
*/
|
||||
@Test
|
||||
public void createUsersWithArrayInputTest() {
|
||||
List<User> body = null;
|
||||
// response = api.createUsersWithArrayInput(body);
|
||||
//assertNotNull(response);
|
||||
// TODO: test validations
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates list of users with given input array
|
||||
*
|
||||
*
|
||||
*
|
||||
* @throws ApiException
|
||||
* if the Api call fails
|
||||
*/
|
||||
@Test
|
||||
public void createUsersWithListInputTest() {
|
||||
List<User> body = null;
|
||||
// response = api.createUsersWithListInput(body);
|
||||
//assertNotNull(response);
|
||||
// TODO: test validations
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete user
|
||||
*
|
||||
* This can only be done by the logged in user.
|
||||
*
|
||||
* @throws ApiException
|
||||
* if the Api call fails
|
||||
*/
|
||||
@Test
|
||||
public void deleteUserTest() {
|
||||
String username = null;
|
||||
// response = api.deleteUser(username);
|
||||
//assertNotNull(response);
|
||||
// TODO: test validations
|
||||
}
|
||||
|
||||
/**
|
||||
* Get user by user name
|
||||
*
|
||||
*
|
||||
*
|
||||
* @throws ApiException
|
||||
* if the Api call fails
|
||||
*/
|
||||
@Test
|
||||
public void getUserByNameTest() {
|
||||
String username = null;
|
||||
//User response = api.getUserByName(username);
|
||||
//assertNotNull(response);
|
||||
// TODO: test validations
|
||||
}
|
||||
|
||||
/**
|
||||
* Logs user into the system
|
||||
*
|
||||
*
|
||||
*
|
||||
* @throws ApiException
|
||||
* if the Api call fails
|
||||
*/
|
||||
@Test
|
||||
public void loginUserTest() {
|
||||
String username = null;
|
||||
String password = null;
|
||||
//String response = api.loginUser(username, password);
|
||||
//assertNotNull(response);
|
||||
// TODO: test validations
|
||||
}
|
||||
|
||||
/**
|
||||
* Logs out current logged in user session
|
||||
*
|
||||
*
|
||||
*
|
||||
* @throws ApiException
|
||||
* if the Api call fails
|
||||
*/
|
||||
@Test
|
||||
public void logoutUserTest() {
|
||||
// response = api.logoutUser();
|
||||
//assertNotNull(response);
|
||||
// TODO: test validations
|
||||
}
|
||||
|
||||
/**
|
||||
* Updated user
|
||||
*
|
||||
* This can only be done by the logged in user.
|
||||
*
|
||||
* @throws ApiException
|
||||
* if the Api call fails
|
||||
*/
|
||||
@Test
|
||||
public void updateUserTest() {
|
||||
String username = null;
|
||||
User body = null;
|
||||
// response = api.updateUser(username, body);
|
||||
//assertNotNull(response);
|
||||
// TODO: test validations
|
||||
}
|
||||
|
||||
}
|
@ -1,60 +0,0 @@
|
||||
package io.swagger.api;
|
||||
|
||||
import io.swagger.model.Pet;
|
||||
import java.io.File;
|
||||
import io.swagger.model.ModelApiResponse;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import javax.ws.rs.*;
|
||||
import javax.ws.rs.core.Response;
|
||||
|
||||
import org.apache.cxf.jaxrs.ext.multipart.*;
|
||||
|
||||
@Path("/v2")
|
||||
public interface PetApi {
|
||||
@POST
|
||||
@Path("/pet")
|
||||
@Consumes({ "application/json", "application/xml" })
|
||||
@Produces({ "application/xml", "application/json" })
|
||||
Response addPet(Pet body);
|
||||
@DELETE
|
||||
@Path("/pet/{petId}")
|
||||
|
||||
@Produces({ "application/xml", "application/json" })
|
||||
Response deletePet(@PathParam("petId") Long petId,@HeaderParam("api_key") String apiKey);
|
||||
@GET
|
||||
@Path("/pet/findByStatus")
|
||||
|
||||
@Produces({ "application/xml", "application/json" })
|
||||
Response findPetsByStatus(@QueryParam("status") List<String> status);
|
||||
@GET
|
||||
@Path("/pet/findByTags")
|
||||
|
||||
@Produces({ "application/xml", "application/json" })
|
||||
Response findPetsByTags(@QueryParam("tags") List<String> tags);
|
||||
@GET
|
||||
@Path("/pet/{petId}")
|
||||
|
||||
@Produces({ "application/xml", "application/json" })
|
||||
Response getPetById(@PathParam("petId") Long petId);
|
||||
@PUT
|
||||
@Path("/pet")
|
||||
@Consumes({ "application/json", "application/xml" })
|
||||
@Produces({ "application/xml", "application/json" })
|
||||
Response updatePet(Pet body);
|
||||
@POST
|
||||
@Path("/pet/{petId}")
|
||||
@Consumes({ "application/x-www-form-urlencoded" })
|
||||
@Produces({ "application/xml", "application/json" })
|
||||
Response updatePetWithForm(@PathParam("petId") Long petId,@Multipart(value = "name", required = false) String name,@Multipart(value = "status", required = false) String status);
|
||||
@POST
|
||||
@Path("/pet/{petId}/uploadImage")
|
||||
@Consumes({ "multipart/form-data" })
|
||||
@Produces({ "application/json" })
|
||||
Response uploadFile(@PathParam("petId") Long petId,@Multipart(value = "additionalMetadata", required = false) String additionalMetadata, @Multipart(value = "file", required = false) InputStream fileInputStream,
|
||||
@Multipart(value = "file" , required = false) Attachment fileDetail);
|
||||
}
|
||||
|
@ -1,38 +0,0 @@
|
||||
package io.swagger.api;
|
||||
|
||||
import java.util.Map;
|
||||
import io.swagger.model.Order;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import javax.ws.rs.*;
|
||||
import javax.ws.rs.core.Response;
|
||||
|
||||
import org.apache.cxf.jaxrs.ext.multipart.*;
|
||||
|
||||
@Path("/v2")
|
||||
public interface StoreApi {
|
||||
@DELETE
|
||||
@Path("/store/order/{orderId}")
|
||||
|
||||
@Produces({ "application/xml", "application/json" })
|
||||
Response deleteOrder(@PathParam("orderId") String orderId);
|
||||
@GET
|
||||
@Path("/store/inventory")
|
||||
|
||||
@Produces({ "application/json" })
|
||||
Response getInventory();
|
||||
@GET
|
||||
@Path("/store/order/{orderId}")
|
||||
|
||||
@Produces({ "application/xml", "application/json" })
|
||||
Response getOrderById(@PathParam("orderId") Long orderId);
|
||||
@POST
|
||||
@Path("/store/order")
|
||||
|
||||
@Produces({ "application/xml", "application/json" })
|
||||
Response placeOrder(Order body);
|
||||
}
|
||||
|
@ -1,58 +0,0 @@
|
||||
package io.swagger.api;
|
||||
|
||||
import io.swagger.model.User;
|
||||
import java.util.List;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import javax.ws.rs.*;
|
||||
import javax.ws.rs.core.Response;
|
||||
|
||||
import org.apache.cxf.jaxrs.ext.multipart.*;
|
||||
|
||||
@Path("/v2")
|
||||
public interface UserApi {
|
||||
@POST
|
||||
@Path("/user")
|
||||
|
||||
@Produces({ "application/xml", "application/json" })
|
||||
Response createUser(User body);
|
||||
@POST
|
||||
@Path("/user/createWithArray")
|
||||
|
||||
@Produces({ "application/xml", "application/json" })
|
||||
Response createUsersWithArrayInput(List<User> body);
|
||||
@POST
|
||||
@Path("/user/createWithList")
|
||||
|
||||
@Produces({ "application/xml", "application/json" })
|
||||
Response createUsersWithListInput(List<User> body);
|
||||
@DELETE
|
||||
@Path("/user/{username}")
|
||||
|
||||
@Produces({ "application/xml", "application/json" })
|
||||
Response deleteUser(@PathParam("username") String username);
|
||||
@GET
|
||||
@Path("/user/{username}")
|
||||
|
||||
@Produces({ "application/xml", "application/json" })
|
||||
Response getUserByName(@PathParam("username") String username);
|
||||
@GET
|
||||
@Path("/user/login")
|
||||
|
||||
@Produces({ "application/xml", "application/json" })
|
||||
Response loginUser(@QueryParam("username") String username,@QueryParam("password") String password);
|
||||
@GET
|
||||
@Path("/user/logout")
|
||||
|
||||
@Produces({ "application/xml", "application/json" })
|
||||
Response logoutUser();
|
||||
@PUT
|
||||
@Path("/user/{username}")
|
||||
|
||||
@Produces({ "application/xml", "application/json" })
|
||||
Response updateUser(@PathParam("username") String username,User body);
|
||||
}
|
||||
|
@ -82,7 +82,7 @@
|
||||
<artifactId>maven-war-plugin</artifactId>
|
||||
<version>2.1.1</version>
|
||||
<configuration>
|
||||
<failOnMissingWebXml>true</failOnMissingWebXml>
|
||||
<failOnMissingWebXml>false</failOnMissingWebXml>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
@ -165,13 +165,13 @@
|
||||
<java.version>1.7</java.version>
|
||||
<maven.compiler.source>${java.version}</maven.compiler.source>
|
||||
<maven.compiler.target>${java.version}</maven.compiler.target>
|
||||
<swagger-core-version>1.5.9</swagger-core-version>
|
||||
<swagger-core-version>1.5.10</swagger-core-version>
|
||||
<jetty-version>9.2.9.v20150224</jetty-version>
|
||||
<jersey2-version>2.22.2</jersey2-version>
|
||||
<junit-version>4.12</junit-version>
|
||||
<logback-version>1.1.7</logback-version>
|
||||
<servlet-api-version>2.5</servlet-api-version>
|
||||
<cxf-version>3.1.7</cxf-version>
|
||||
<cxf-version>3.1.8</cxf-version>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
</project>
|
||||
|
@ -0,0 +1,77 @@
|
||||
package io.swagger.api;
|
||||
|
||||
import io.swagger.model.Pet;
|
||||
import io.swagger.model.ModelApiResponse;
|
||||
import java.io.File;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import javax.ws.rs.*;
|
||||
import javax.ws.rs.core.Response;
|
||||
import javax.ws.rs.core.MediaType;
|
||||
import org.apache.cxf.jaxrs.ext.multipart.*;
|
||||
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
|
||||
@Path("/")
|
||||
@Api(value = "/", description = "")
|
||||
@Consumes(MediaType.APPLICATION_JSON)
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public interface PetApi {
|
||||
|
||||
@POST
|
||||
@Path("/pet")
|
||||
@Consumes({ "application/json", "application/xml" })
|
||||
@Produces({ "application/xml", "application/json" })
|
||||
@ApiOperation(value = "Add a new pet to the store", tags={ "pet", })
|
||||
public void addPet(Pet body);
|
||||
|
||||
@DELETE
|
||||
@Path("/pet/{petId}")
|
||||
@Produces({ "application/xml", "application/json" })
|
||||
@ApiOperation(value = "Deletes a pet", tags={ "pet", })
|
||||
public void deletePet(@PathParam("petId") Long petId, @HeaderParam("api_key") String apiKey);
|
||||
|
||||
@GET
|
||||
@Path("/pet/findByStatus")
|
||||
@Produces({ "application/xml", "application/json" })
|
||||
@ApiOperation(value = "Finds Pets by status", tags={ "pet", })
|
||||
public Pet findPetsByStatus(@QueryParam("status")List<String> status);
|
||||
|
||||
@GET
|
||||
@Path("/pet/findByTags")
|
||||
@Produces({ "application/xml", "application/json" })
|
||||
@ApiOperation(value = "Finds Pets by tags", tags={ "pet", })
|
||||
public Pet findPetsByTags(@QueryParam("tags")List<String> tags);
|
||||
|
||||
@GET
|
||||
@Path("/pet/{petId}")
|
||||
@Produces({ "application/xml", "application/json" })
|
||||
@ApiOperation(value = "Find pet by ID", tags={ "pet", })
|
||||
public Pet getPetById(@PathParam("petId") Long petId);
|
||||
|
||||
@PUT
|
||||
@Path("/pet")
|
||||
@Consumes({ "application/json", "application/xml" })
|
||||
@Produces({ "application/xml", "application/json" })
|
||||
@ApiOperation(value = "Update an existing pet", tags={ "pet", })
|
||||
public void updatePet(Pet body);
|
||||
|
||||
@POST
|
||||
@Path("/pet/{petId}")
|
||||
@Consumes({ "application/x-www-form-urlencoded" })
|
||||
@Produces({ "application/xml", "application/json" })
|
||||
@ApiOperation(value = "Updates a pet in the store with form data", tags={ "pet", })
|
||||
public void updatePetWithForm(@PathParam("petId") Long petId, @Multipart(value = "name", required = false) String name, @Multipart(value = "status", required = false) String status);
|
||||
|
||||
@POST
|
||||
@Path("/pet/{petId}/uploadImage")
|
||||
@Consumes({ "multipart/form-data" })
|
||||
@Produces({ "application/json" })
|
||||
@ApiOperation(value = "uploads an image", tags={ "pet" })
|
||||
public ModelApiResponse uploadFile(@PathParam("petId") Long petId, @Multipart(value = "additionalMetadata", required = false) String additionalMetadata, @Multipart(value = "file" , required = false) Attachment fileDetail);
|
||||
}
|
||||
|
@ -0,0 +1,48 @@
|
||||
package io.swagger.api;
|
||||
|
||||
import java.util.Map;
|
||||
import io.swagger.model.Order;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import javax.ws.rs.*;
|
||||
import javax.ws.rs.core.Response;
|
||||
import javax.ws.rs.core.MediaType;
|
||||
import org.apache.cxf.jaxrs.ext.multipart.*;
|
||||
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
|
||||
@Path("/")
|
||||
@Api(value = "/", description = "")
|
||||
@Consumes(MediaType.APPLICATION_JSON)
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public interface StoreApi {
|
||||
|
||||
@DELETE
|
||||
@Path("/store/order/{orderId}")
|
||||
@Produces({ "application/xml", "application/json" })
|
||||
@ApiOperation(value = "Delete purchase order by ID", tags={ "store", })
|
||||
public void deleteOrder(@PathParam("orderId") String orderId);
|
||||
|
||||
@GET
|
||||
@Path("/store/inventory")
|
||||
@Produces({ "application/json" })
|
||||
@ApiOperation(value = "Returns pet inventories by status", tags={ "store", })
|
||||
public Integer getInventory();
|
||||
|
||||
@GET
|
||||
@Path("/store/order/{orderId}")
|
||||
@Produces({ "application/xml", "application/json" })
|
||||
@ApiOperation(value = "Find purchase order by ID", tags={ "store", })
|
||||
public Order getOrderById(@PathParam("orderId") Long orderId);
|
||||
|
||||
@POST
|
||||
@Path("/store/order")
|
||||
@Produces({ "application/xml", "application/json" })
|
||||
@ApiOperation(value = "Place an order for a pet", tags={ "store" })
|
||||
public Order placeOrder(Order body);
|
||||
}
|
||||
|
@ -0,0 +1,72 @@
|
||||
package io.swagger.api;
|
||||
|
||||
import io.swagger.model.User;
|
||||
import java.util.List;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import javax.ws.rs.*;
|
||||
import javax.ws.rs.core.Response;
|
||||
import javax.ws.rs.core.MediaType;
|
||||
import org.apache.cxf.jaxrs.ext.multipart.*;
|
||||
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
|
||||
@Path("/")
|
||||
@Api(value = "/", description = "")
|
||||
@Consumes(MediaType.APPLICATION_JSON)
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public interface UserApi {
|
||||
|
||||
@POST
|
||||
@Path("/user")
|
||||
@Produces({ "application/xml", "application/json" })
|
||||
@ApiOperation(value = "Create user", tags={ "user", })
|
||||
public void createUser(User body);
|
||||
|
||||
@POST
|
||||
@Path("/user/createWithArray")
|
||||
@Produces({ "application/xml", "application/json" })
|
||||
@ApiOperation(value = "Creates list of users with given input array", tags={ "user", })
|
||||
public void createUsersWithArrayInput(List<User> body);
|
||||
|
||||
@POST
|
||||
@Path("/user/createWithList")
|
||||
@Produces({ "application/xml", "application/json" })
|
||||
@ApiOperation(value = "Creates list of users with given input array", tags={ "user", })
|
||||
public void createUsersWithListInput(List<User> body);
|
||||
|
||||
@DELETE
|
||||
@Path("/user/{username}")
|
||||
@Produces({ "application/xml", "application/json" })
|
||||
@ApiOperation(value = "Delete user", tags={ "user", })
|
||||
public void deleteUser(@PathParam("username") String username);
|
||||
|
||||
@GET
|
||||
@Path("/user/{username}")
|
||||
@Produces({ "application/xml", "application/json" })
|
||||
@ApiOperation(value = "Get user by user name", tags={ "user", })
|
||||
public User getUserByName(@PathParam("username") String username);
|
||||
|
||||
@GET
|
||||
@Path("/user/login")
|
||||
@Produces({ "application/xml", "application/json" })
|
||||
@ApiOperation(value = "Logs user into the system", tags={ "user", })
|
||||
public String loginUser(@QueryParam("username")String username, @QueryParam("password")String password);
|
||||
|
||||
@GET
|
||||
@Path("/user/logout")
|
||||
@Produces({ "application/xml", "application/json" })
|
||||
@ApiOperation(value = "Logs out current logged in user session", tags={ "user", })
|
||||
public void logoutUser();
|
||||
|
||||
@PUT
|
||||
@Path("/user/{username}")
|
||||
@Produces({ "application/xml", "application/json" })
|
||||
@ApiOperation(value = "Updated user", tags={ "user" })
|
||||
public void updateUser(@PathParam("username") String username, User body);
|
||||
}
|
||||
|
@ -0,0 +1,65 @@
|
||||
package io.swagger.model;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
import javax.xml.bind.annotation.XmlAccessorType;
|
||||
import javax.xml.bind.annotation.XmlType;
|
||||
import javax.xml.bind.annotation.XmlEnum;
|
||||
import javax.xml.bind.annotation.XmlEnumValue;
|
||||
|
||||
@ApiModel(description="A category for a pet")
|
||||
public class Category {
|
||||
|
||||
@ApiModelProperty(example = "null", value = "")
|
||||
private Long id = null;
|
||||
@ApiModelProperty(example = "null", value = "")
|
||||
private String name = null;
|
||||
|
||||
/**
|
||||
* Get id
|
||||
* @return id
|
||||
**/
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
/**
|
||||
* Get name
|
||||
* @return name
|
||||
**/
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("class Category {\n");
|
||||
|
||||
sb.append(" id: ").append(toIndentedString(id)).append("\n");
|
||||
sb.append(" name: ").append(toIndentedString(name)).append("\n");
|
||||
sb.append("}");
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert the given object to string with each line indented by 4 spaces
|
||||
* (except the first line).
|
||||
*/
|
||||
private static String toIndentedString(Object o) {
|
||||
if (o == null) {
|
||||
return "null";
|
||||
}
|
||||
return o.toString().replace("\n", "\n ");
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,78 @@
|
||||
package io.swagger.model;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
import javax.xml.bind.annotation.XmlAccessorType;
|
||||
import javax.xml.bind.annotation.XmlType;
|
||||
import javax.xml.bind.annotation.XmlEnum;
|
||||
import javax.xml.bind.annotation.XmlEnumValue;
|
||||
|
||||
@ApiModel(description="Describes the result of uploading an image resource")
|
||||
public class ModelApiResponse {
|
||||
|
||||
@ApiModelProperty(example = "null", value = "")
|
||||
private Integer code = null;
|
||||
@ApiModelProperty(example = "null", value = "")
|
||||
private String type = null;
|
||||
@ApiModelProperty(example = "null", value = "")
|
||||
private String message = null;
|
||||
|
||||
/**
|
||||
* Get code
|
||||
* @return code
|
||||
**/
|
||||
public Integer getCode() {
|
||||
return code;
|
||||
}
|
||||
public void setCode(Integer code) {
|
||||
this.code = code;
|
||||
}
|
||||
/**
|
||||
* Get type
|
||||
* @return type
|
||||
**/
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
/**
|
||||
* Get message
|
||||
* @return message
|
||||
**/
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
public void setMessage(String message) {
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("class ModelApiResponse {\n");
|
||||
|
||||
sb.append(" code: ").append(toIndentedString(code)).append("\n");
|
||||
sb.append(" type: ").append(toIndentedString(type)).append("\n");
|
||||
sb.append(" message: ").append(toIndentedString(message)).append("\n");
|
||||
sb.append("}");
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert the given object to string with each line indented by 4 spaces
|
||||
* (except the first line).
|
||||
*/
|
||||
private static String toIndentedString(Object o) {
|
||||
if (o == null) {
|
||||
return "null";
|
||||
}
|
||||
return o.toString().replace("\n", "\n ");
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,150 @@
|
||||
package io.swagger.model;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
import javax.xml.bind.annotation.XmlAccessorType;
|
||||
import javax.xml.bind.annotation.XmlType;
|
||||
import javax.xml.bind.annotation.XmlEnum;
|
||||
import javax.xml.bind.annotation.XmlEnumValue;
|
||||
|
||||
@ApiModel(description="An order for a pets from the pet store")
|
||||
public class Order {
|
||||
|
||||
@ApiModelProperty(example = "null", value = "")
|
||||
private Long id = null;
|
||||
@ApiModelProperty(example = "null", value = "")
|
||||
private Long petId = null;
|
||||
@ApiModelProperty(example = "null", value = "")
|
||||
private Integer quantity = null;
|
||||
@ApiModelProperty(example = "null", value = "")
|
||||
private javax.xml.datatype.XMLGregorianCalendar shipDate = null;
|
||||
|
||||
@XmlType(name="StatusEnum")
|
||||
@XmlEnum(String.class)
|
||||
public enum StatusEnum {
|
||||
|
||||
@XmlEnumValue("placed") PLACED(String.valueOf("placed")), @XmlEnumValue("approved") APPROVED(String.valueOf("approved")), @XmlEnumValue("delivered") DELIVERED(String.valueOf("delivered"));
|
||||
|
||||
|
||||
private String value;
|
||||
|
||||
StatusEnum (String v) {
|
||||
value = v;
|
||||
}
|
||||
|
||||
public String value() {
|
||||
return value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return String.valueOf(value);
|
||||
}
|
||||
|
||||
public static StatusEnum fromValue(String v) {
|
||||
for (StatusEnum b : StatusEnum.values()) {
|
||||
if (String.valueOf(b.value).equals(v)) {
|
||||
return b;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@ApiModelProperty(example = "null", value = "Order Status")
|
||||
private StatusEnum status = null;
|
||||
@ApiModelProperty(example = "null", value = "")
|
||||
private Boolean complete = false;
|
||||
|
||||
/**
|
||||
* Get id
|
||||
* @return id
|
||||
**/
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
/**
|
||||
* Get petId
|
||||
* @return petId
|
||||
**/
|
||||
public Long getPetId() {
|
||||
return petId;
|
||||
}
|
||||
public void setPetId(Long petId) {
|
||||
this.petId = petId;
|
||||
}
|
||||
/**
|
||||
* Get quantity
|
||||
* @return quantity
|
||||
**/
|
||||
public Integer getQuantity() {
|
||||
return quantity;
|
||||
}
|
||||
public void setQuantity(Integer quantity) {
|
||||
this.quantity = quantity;
|
||||
}
|
||||
/**
|
||||
* Get shipDate
|
||||
* @return shipDate
|
||||
**/
|
||||
public javax.xml.datatype.XMLGregorianCalendar getShipDate() {
|
||||
return shipDate;
|
||||
}
|
||||
public void setShipDate(javax.xml.datatype.XMLGregorianCalendar shipDate) {
|
||||
this.shipDate = shipDate;
|
||||
}
|
||||
/**
|
||||
* Order Status
|
||||
* @return status
|
||||
**/
|
||||
public StatusEnum getStatus() {
|
||||
return status;
|
||||
}
|
||||
public void setStatus(StatusEnum status) {
|
||||
this.status = status;
|
||||
}
|
||||
/**
|
||||
* Get complete
|
||||
* @return complete
|
||||
**/
|
||||
public Boolean getComplete() {
|
||||
return complete;
|
||||
}
|
||||
public void setComplete(Boolean complete) {
|
||||
this.complete = complete;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("class Order {\n");
|
||||
|
||||
sb.append(" id: ").append(toIndentedString(id)).append("\n");
|
||||
sb.append(" petId: ").append(toIndentedString(petId)).append("\n");
|
||||
sb.append(" quantity: ").append(toIndentedString(quantity)).append("\n");
|
||||
sb.append(" shipDate: ").append(toIndentedString(shipDate)).append("\n");
|
||||
sb.append(" status: ").append(toIndentedString(status)).append("\n");
|
||||
sb.append(" complete: ").append(toIndentedString(complete)).append("\n");
|
||||
sb.append("}");
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert the given object to string with each line indented by 4 spaces
|
||||
* (except the first line).
|
||||
*/
|
||||
private static String toIndentedString(Object o) {
|
||||
if (o == null) {
|
||||
return "null";
|
||||
}
|
||||
return o.toString().replace("\n", "\n ");
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,154 @@
|
||||
package io.swagger.model;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.model.Category;
|
||||
import io.swagger.model.Tag;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
import javax.xml.bind.annotation.XmlAccessorType;
|
||||
import javax.xml.bind.annotation.XmlType;
|
||||
import javax.xml.bind.annotation.XmlEnum;
|
||||
import javax.xml.bind.annotation.XmlEnumValue;
|
||||
|
||||
@ApiModel(description="A pet for sale in the pet store")
|
||||
public class Pet {
|
||||
|
||||
@ApiModelProperty(example = "null", value = "")
|
||||
private Long id = null;
|
||||
@ApiModelProperty(example = "null", value = "")
|
||||
private Category category = null;
|
||||
@ApiModelProperty(example = "doggie", required = true, value = "")
|
||||
private String name = null;
|
||||
@ApiModelProperty(example = "null", required = true, value = "")
|
||||
private List<String> photoUrls = new ArrayList<String>();
|
||||
@ApiModelProperty(example = "null", value = "")
|
||||
private List<Tag> tags = new ArrayList<Tag>();
|
||||
|
||||
@XmlType(name="StatusEnum")
|
||||
@XmlEnum(String.class)
|
||||
public enum StatusEnum {
|
||||
|
||||
@XmlEnumValue("available") AVAILABLE(String.valueOf("available")), @XmlEnumValue("pending") PENDING(String.valueOf("pending")), @XmlEnumValue("sold") SOLD(String.valueOf("sold"));
|
||||
|
||||
|
||||
private String value;
|
||||
|
||||
StatusEnum (String v) {
|
||||
value = v;
|
||||
}
|
||||
|
||||
public String value() {
|
||||
return value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return String.valueOf(value);
|
||||
}
|
||||
|
||||
public static StatusEnum fromValue(String v) {
|
||||
for (StatusEnum b : StatusEnum.values()) {
|
||||
if (String.valueOf(b.value).equals(v)) {
|
||||
return b;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@ApiModelProperty(example = "null", value = "pet status in the store")
|
||||
private StatusEnum status = null;
|
||||
|
||||
/**
|
||||
* Get id
|
||||
* @return id
|
||||
**/
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
/**
|
||||
* Get category
|
||||
* @return category
|
||||
**/
|
||||
public Category getCategory() {
|
||||
return category;
|
||||
}
|
||||
public void setCategory(Category category) {
|
||||
this.category = category;
|
||||
}
|
||||
/**
|
||||
* Get name
|
||||
* @return name
|
||||
**/
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
/**
|
||||
* Get photoUrls
|
||||
* @return photoUrls
|
||||
**/
|
||||
public List<String> getPhotoUrls() {
|
||||
return photoUrls;
|
||||
}
|
||||
public void setPhotoUrls(List<String> photoUrls) {
|
||||
this.photoUrls = photoUrls;
|
||||
}
|
||||
/**
|
||||
* Get tags
|
||||
* @return tags
|
||||
**/
|
||||
public List<Tag> getTags() {
|
||||
return tags;
|
||||
}
|
||||
public void setTags(List<Tag> tags) {
|
||||
this.tags = tags;
|
||||
}
|
||||
/**
|
||||
* pet status in the store
|
||||
* @return status
|
||||
**/
|
||||
public StatusEnum getStatus() {
|
||||
return status;
|
||||
}
|
||||
public void setStatus(StatusEnum status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("class Pet {\n");
|
||||
|
||||
sb.append(" id: ").append(toIndentedString(id)).append("\n");
|
||||
sb.append(" category: ").append(toIndentedString(category)).append("\n");
|
||||
sb.append(" name: ").append(toIndentedString(name)).append("\n");
|
||||
sb.append(" photoUrls: ").append(toIndentedString(photoUrls)).append("\n");
|
||||
sb.append(" tags: ").append(toIndentedString(tags)).append("\n");
|
||||
sb.append(" status: ").append(toIndentedString(status)).append("\n");
|
||||
sb.append("}");
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert the given object to string with each line indented by 4 spaces
|
||||
* (except the first line).
|
||||
*/
|
||||
private static String toIndentedString(Object o) {
|
||||
if (o == null) {
|
||||
return "null";
|
||||
}
|
||||
return o.toString().replace("\n", "\n ");
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,65 @@
|
||||
package io.swagger.model;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
import javax.xml.bind.annotation.XmlAccessorType;
|
||||
import javax.xml.bind.annotation.XmlType;
|
||||
import javax.xml.bind.annotation.XmlEnum;
|
||||
import javax.xml.bind.annotation.XmlEnumValue;
|
||||
|
||||
@ApiModel(description="A tag for a pet")
|
||||
public class Tag {
|
||||
|
||||
@ApiModelProperty(example = "null", value = "")
|
||||
private Long id = null;
|
||||
@ApiModelProperty(example = "null", value = "")
|
||||
private String name = null;
|
||||
|
||||
/**
|
||||
* Get id
|
||||
* @return id
|
||||
**/
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
/**
|
||||
* Get name
|
||||
* @return name
|
||||
**/
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("class Tag {\n");
|
||||
|
||||
sb.append(" id: ").append(toIndentedString(id)).append("\n");
|
||||
sb.append(" name: ").append(toIndentedString(name)).append("\n");
|
||||
sb.append("}");
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert the given object to string with each line indented by 4 spaces
|
||||
* (except the first line).
|
||||
*/
|
||||
private static String toIndentedString(Object o) {
|
||||
if (o == null) {
|
||||
return "null";
|
||||
}
|
||||
return o.toString().replace("\n", "\n ");
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,143 @@
|
||||
package io.swagger.model;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
import javax.xml.bind.annotation.XmlAccessorType;
|
||||
import javax.xml.bind.annotation.XmlType;
|
||||
import javax.xml.bind.annotation.XmlEnum;
|
||||
import javax.xml.bind.annotation.XmlEnumValue;
|
||||
|
||||
@ApiModel(description="A User who is purchasing from the pet store")
|
||||
public class User {
|
||||
|
||||
@ApiModelProperty(example = "null", value = "")
|
||||
private Long id = null;
|
||||
@ApiModelProperty(example = "null", value = "")
|
||||
private String username = null;
|
||||
@ApiModelProperty(example = "null", value = "")
|
||||
private String firstName = null;
|
||||
@ApiModelProperty(example = "null", value = "")
|
||||
private String lastName = null;
|
||||
@ApiModelProperty(example = "null", value = "")
|
||||
private String email = null;
|
||||
@ApiModelProperty(example = "null", value = "")
|
||||
private String password = null;
|
||||
@ApiModelProperty(example = "null", value = "")
|
||||
private String phone = null;
|
||||
@ApiModelProperty(example = "null", value = "User Status")
|
||||
private Integer userStatus = null;
|
||||
|
||||
/**
|
||||
* Get id
|
||||
* @return id
|
||||
**/
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
/**
|
||||
* Get username
|
||||
* @return username
|
||||
**/
|
||||
public String getUsername() {
|
||||
return username;
|
||||
}
|
||||
public void setUsername(String username) {
|
||||
this.username = username;
|
||||
}
|
||||
/**
|
||||
* Get firstName
|
||||
* @return firstName
|
||||
**/
|
||||
public String getFirstName() {
|
||||
return firstName;
|
||||
}
|
||||
public void setFirstName(String firstName) {
|
||||
this.firstName = firstName;
|
||||
}
|
||||
/**
|
||||
* Get lastName
|
||||
* @return lastName
|
||||
**/
|
||||
public String getLastName() {
|
||||
return lastName;
|
||||
}
|
||||
public void setLastName(String lastName) {
|
||||
this.lastName = lastName;
|
||||
}
|
||||
/**
|
||||
* Get email
|
||||
* @return email
|
||||
**/
|
||||
public String getEmail() {
|
||||
return email;
|
||||
}
|
||||
public void setEmail(String email) {
|
||||
this.email = email;
|
||||
}
|
||||
/**
|
||||
* Get password
|
||||
* @return password
|
||||
**/
|
||||
public String getPassword() {
|
||||
return password;
|
||||
}
|
||||
public void setPassword(String password) {
|
||||
this.password = password;
|
||||
}
|
||||
/**
|
||||
* Get phone
|
||||
* @return phone
|
||||
**/
|
||||
public String getPhone() {
|
||||
return phone;
|
||||
}
|
||||
public void setPhone(String phone) {
|
||||
this.phone = phone;
|
||||
}
|
||||
/**
|
||||
* User Status
|
||||
* @return userStatus
|
||||
**/
|
||||
public Integer getUserStatus() {
|
||||
return userStatus;
|
||||
}
|
||||
public void setUserStatus(Integer userStatus) {
|
||||
this.userStatus = userStatus;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("class User {\n");
|
||||
|
||||
sb.append(" id: ").append(toIndentedString(id)).append("\n");
|
||||
sb.append(" username: ").append(toIndentedString(username)).append("\n");
|
||||
sb.append(" firstName: ").append(toIndentedString(firstName)).append("\n");
|
||||
sb.append(" lastName: ").append(toIndentedString(lastName)).append("\n");
|
||||
sb.append(" email: ").append(toIndentedString(email)).append("\n");
|
||||
sb.append(" password: ").append(toIndentedString(password)).append("\n");
|
||||
sb.append(" phone: ").append(toIndentedString(phone)).append("\n");
|
||||
sb.append(" userStatus: ").append(toIndentedString(userStatus)).append("\n");
|
||||
sb.append("}");
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert the given object to string with each line indented by 4 spaces
|
||||
* (except the first line).
|
||||
*/
|
||||
private static String toIndentedString(Object o) {
|
||||
if (o == null) {
|
||||
return "null";
|
||||
}
|
||||
return o.toString().replace("\n", "\n ");
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,71 @@
|
||||
package io.swagger.api.impl;
|
||||
|
||||
import io.swagger.api.*;
|
||||
import io.swagger.model.Pet;
|
||||
import io.swagger.model.ModelApiResponse;
|
||||
import java.io.File;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import javax.ws.rs.*;
|
||||
import javax.ws.rs.core.Response;
|
||||
import org.apache.cxf.jaxrs.model.wadl.Description;
|
||||
import org.apache.cxf.jaxrs.model.wadl.DocTarget;
|
||||
|
||||
import org.apache.cxf.jaxrs.ext.multipart.*;
|
||||
|
||||
import io.swagger.annotations.Api;
|
||||
|
||||
public class PetApiServiceImpl implements PetApi {
|
||||
public void addPet(Pet body) {
|
||||
// TODO: Implement...
|
||||
|
||||
|
||||
}
|
||||
|
||||
public void deletePet(Long petId, String apiKey) {
|
||||
// TODO: Implement...
|
||||
|
||||
|
||||
}
|
||||
|
||||
public Pet findPetsByStatus(List<String> status) {
|
||||
// TODO: Implement...
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public Pet findPetsByTags(List<String> tags) {
|
||||
// TODO: Implement...
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public Pet getPetById(Long petId) {
|
||||
// TODO: Implement...
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public void updatePet(Pet body) {
|
||||
// TODO: Implement...
|
||||
|
||||
|
||||
}
|
||||
|
||||
public void updatePetWithForm(Long petId, String name, String status) {
|
||||
// TODO: Implement...
|
||||
|
||||
|
||||
}
|
||||
|
||||
public ModelApiResponse uploadFile(Long petId, String additionalMetadata, Attachment fileDetail) {
|
||||
// TODO: Implement...
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,46 @@
|
||||
package io.swagger.api.impl;
|
||||
|
||||
import io.swagger.api.*;
|
||||
import java.util.Map;
|
||||
import io.swagger.model.Order;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import javax.ws.rs.*;
|
||||
import javax.ws.rs.core.Response;
|
||||
import org.apache.cxf.jaxrs.model.wadl.Description;
|
||||
import org.apache.cxf.jaxrs.model.wadl.DocTarget;
|
||||
|
||||
import org.apache.cxf.jaxrs.ext.multipart.*;
|
||||
|
||||
import io.swagger.annotations.Api;
|
||||
|
||||
public class StoreApiServiceImpl implements StoreApi {
|
||||
public void deleteOrder(String orderId) {
|
||||
// TODO: Implement...
|
||||
|
||||
|
||||
}
|
||||
|
||||
public Integer getInventory() {
|
||||
// TODO: Implement...
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public Order getOrderById(Long orderId) {
|
||||
// TODO: Implement...
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public Order placeOrder(Order body) {
|
||||
// TODO: Implement...
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,70 @@
|
||||
package io.swagger.api.impl;
|
||||
|
||||
import io.swagger.api.*;
|
||||
import io.swagger.model.User;
|
||||
import java.util.List;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import javax.ws.rs.*;
|
||||
import javax.ws.rs.core.Response;
|
||||
import org.apache.cxf.jaxrs.model.wadl.Description;
|
||||
import org.apache.cxf.jaxrs.model.wadl.DocTarget;
|
||||
|
||||
import org.apache.cxf.jaxrs.ext.multipart.*;
|
||||
|
||||
import io.swagger.annotations.Api;
|
||||
|
||||
public class UserApiServiceImpl implements UserApi {
|
||||
public void createUser(User body) {
|
||||
// TODO: Implement...
|
||||
|
||||
|
||||
}
|
||||
|
||||
public void createUsersWithArrayInput(List<User> body) {
|
||||
// TODO: Implement...
|
||||
|
||||
|
||||
}
|
||||
|
||||
public void createUsersWithListInput(List<User> body) {
|
||||
// TODO: Implement...
|
||||
|
||||
|
||||
}
|
||||
|
||||
public void deleteUser(String username) {
|
||||
// TODO: Implement...
|
||||
|
||||
|
||||
}
|
||||
|
||||
public User getUserByName(String username) {
|
||||
// TODO: Implement...
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public String loginUser(String username, String password) {
|
||||
// TODO: Implement...
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public void logoutUser() {
|
||||
// TODO: Implement...
|
||||
|
||||
|
||||
}
|
||||
|
||||
public void updateUser(String username, User body) {
|
||||
// TODO: Implement...
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,221 @@
|
||||
/**
|
||||
* Swagger Petstore
|
||||
* This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.
|
||||
*
|
||||
* OpenAPI spec version: 1.0.0
|
||||
* Contact: apiteam@swagger.io
|
||||
*
|
||||
* NOTE: This class is auto generated by the swagger code generator program.
|
||||
* https://github.com/swagger-api/swagger-codegen.git
|
||||
* Do not edit the class manually.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
package io.swagger.api;
|
||||
|
||||
import io.swagger.model.Pet;
|
||||
import io.swagger.model.ModelApiResponse;
|
||||
import java.io.File;
|
||||
import org.junit.Test;
|
||||
import org.junit.Before;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
import javax.ws.rs.core.Response;
|
||||
import org.apache.cxf.jaxrs.client.JAXRSClientFactory;
|
||||
import org.apache.cxf.jaxrs.client.ClientConfiguration;
|
||||
import org.apache.cxf.jaxrs.client.WebClient;
|
||||
|
||||
|
||||
import com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* API tests for PetApi
|
||||
*/
|
||||
public class PetApiTest {
|
||||
|
||||
|
||||
private PetApi api;
|
||||
|
||||
@Before
|
||||
public void setup() {
|
||||
JacksonJsonProvider provider = new JacksonJsonProvider();
|
||||
List providers = new ArrayList();
|
||||
providers.add(provider);
|
||||
|
||||
api = JAXRSClientFactory.create("http://petstore.swagger.io/v2", PetApi.class, providers);
|
||||
org.apache.cxf.jaxrs.client.Client client = WebClient.client(api);
|
||||
|
||||
ClientConfiguration config = WebClient.getConfig(client);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Add a new pet to the store
|
||||
*
|
||||
*
|
||||
*
|
||||
* @throws ApiException
|
||||
* if the Api call fails
|
||||
*/
|
||||
@Test
|
||||
public void addPetTest() {
|
||||
Pet body = null;
|
||||
//api.addPet(body);
|
||||
|
||||
// TODO: test validations
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes a pet
|
||||
*
|
||||
*
|
||||
*
|
||||
* @throws ApiException
|
||||
* if the Api call fails
|
||||
*/
|
||||
@Test
|
||||
public void deletePetTest() {
|
||||
Long petId = null;
|
||||
String apiKey = null;
|
||||
//api.deletePet(petId, apiKey);
|
||||
|
||||
// TODO: test validations
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Finds Pets by status
|
||||
*
|
||||
* Multiple status values can be provided with comma separated strings
|
||||
*
|
||||
* @throws ApiException
|
||||
* if the Api call fails
|
||||
*/
|
||||
@Test
|
||||
public void findPetsByStatusTest() {
|
||||
List<String> status = null;
|
||||
//Pet response = api.findPetsByStatus(status);
|
||||
//assertNotNull(response);
|
||||
// TODO: test validations
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Finds Pets by tags
|
||||
*
|
||||
* Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
|
||||
*
|
||||
* @throws ApiException
|
||||
* if the Api call fails
|
||||
*/
|
||||
@Test
|
||||
public void findPetsByTagsTest() {
|
||||
List<String> tags = null;
|
||||
//Pet response = api.findPetsByTags(tags);
|
||||
//assertNotNull(response);
|
||||
// TODO: test validations
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Find pet by ID
|
||||
*
|
||||
* Returns a single pet
|
||||
*
|
||||
* @throws ApiException
|
||||
* if the Api call fails
|
||||
*/
|
||||
@Test
|
||||
public void getPetByIdTest() {
|
||||
Long petId = null;
|
||||
//Pet response = api.getPetById(petId);
|
||||
//assertNotNull(response);
|
||||
// TODO: test validations
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Update an existing pet
|
||||
*
|
||||
*
|
||||
*
|
||||
* @throws ApiException
|
||||
* if the Api call fails
|
||||
*/
|
||||
@Test
|
||||
public void updatePetTest() {
|
||||
Pet body = null;
|
||||
//api.updatePet(body);
|
||||
|
||||
// TODO: test validations
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates a pet in the store with form data
|
||||
*
|
||||
*
|
||||
*
|
||||
* @throws ApiException
|
||||
* if the Api call fails
|
||||
*/
|
||||
@Test
|
||||
public void updatePetWithFormTest() {
|
||||
Long petId = null;
|
||||
String name = null;
|
||||
String status = null;
|
||||
//api.updatePetWithForm(petId, name, status);
|
||||
|
||||
// TODO: test validations
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* uploads an image
|
||||
*
|
||||
*
|
||||
*
|
||||
* @throws ApiException
|
||||
* if the Api call fails
|
||||
*/
|
||||
@Test
|
||||
public void uploadFileTest() {
|
||||
Long petId = null;
|
||||
String additionalMetadata = null;
|
||||
org.apache.cxf.jaxrs.ext.multipart.Attachment file = null;
|
||||
//ModelApiResponse response = api.uploadFile(petId, additionalMetadata, file);
|
||||
//assertNotNull(response);
|
||||
// TODO: test validations
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,142 @@
|
||||
/**
|
||||
* Swagger Petstore
|
||||
* This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.
|
||||
*
|
||||
* OpenAPI spec version: 1.0.0
|
||||
* Contact: apiteam@swagger.io
|
||||
*
|
||||
* NOTE: This class is auto generated by the swagger code generator program.
|
||||
* https://github.com/swagger-api/swagger-codegen.git
|
||||
* Do not edit the class manually.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
package io.swagger.api;
|
||||
|
||||
import java.util.Map;
|
||||
import io.swagger.model.Order;
|
||||
import org.junit.Test;
|
||||
import org.junit.Before;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
import javax.ws.rs.core.Response;
|
||||
import org.apache.cxf.jaxrs.client.JAXRSClientFactory;
|
||||
import org.apache.cxf.jaxrs.client.ClientConfiguration;
|
||||
import org.apache.cxf.jaxrs.client.WebClient;
|
||||
|
||||
|
||||
import com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* API tests for StoreApi
|
||||
*/
|
||||
public class StoreApiTest {
|
||||
|
||||
|
||||
private StoreApi api;
|
||||
|
||||
@Before
|
||||
public void setup() {
|
||||
JacksonJsonProvider provider = new JacksonJsonProvider();
|
||||
List providers = new ArrayList();
|
||||
providers.add(provider);
|
||||
|
||||
api = JAXRSClientFactory.create("http://petstore.swagger.io/v2", StoreApi.class, providers);
|
||||
org.apache.cxf.jaxrs.client.Client client = WebClient.client(api);
|
||||
|
||||
ClientConfiguration config = WebClient.getConfig(client);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Delete purchase order by ID
|
||||
*
|
||||
* For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
|
||||
*
|
||||
* @throws ApiException
|
||||
* if the Api call fails
|
||||
*/
|
||||
@Test
|
||||
public void deleteOrderTest() {
|
||||
String orderId = null;
|
||||
//api.deleteOrder(orderId);
|
||||
|
||||
// TODO: test validations
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns pet inventories by status
|
||||
*
|
||||
* Returns a map of status codes to quantities
|
||||
*
|
||||
* @throws ApiException
|
||||
* if the Api call fails
|
||||
*/
|
||||
@Test
|
||||
public void getInventoryTest() {
|
||||
//Integer response = api.getInventory();
|
||||
//assertNotNull(response);
|
||||
// TODO: test validations
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Find purchase order by ID
|
||||
*
|
||||
* For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions
|
||||
*
|
||||
* @throws ApiException
|
||||
* if the Api call fails
|
||||
*/
|
||||
@Test
|
||||
public void getOrderByIdTest() {
|
||||
Long orderId = null;
|
||||
//Order response = api.getOrderById(orderId);
|
||||
//assertNotNull(response);
|
||||
// TODO: test validations
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Place an order for a pet
|
||||
*
|
||||
*
|
||||
*
|
||||
* @throws ApiException
|
||||
* if the Api call fails
|
||||
*/
|
||||
@Test
|
||||
public void placeOrderTest() {
|
||||
Order body = null;
|
||||
//Order response = api.placeOrder(body);
|
||||
//assertNotNull(response);
|
||||
// TODO: test validations
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,216 @@
|
||||
/**
|
||||
* Swagger Petstore
|
||||
* This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.
|
||||
*
|
||||
* OpenAPI spec version: 1.0.0
|
||||
* Contact: apiteam@swagger.io
|
||||
*
|
||||
* NOTE: This class is auto generated by the swagger code generator program.
|
||||
* https://github.com/swagger-api/swagger-codegen.git
|
||||
* Do not edit the class manually.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
package io.swagger.api;
|
||||
|
||||
import io.swagger.model.User;
|
||||
import java.util.List;
|
||||
import org.junit.Test;
|
||||
import org.junit.Before;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
import javax.ws.rs.core.Response;
|
||||
import org.apache.cxf.jaxrs.client.JAXRSClientFactory;
|
||||
import org.apache.cxf.jaxrs.client.ClientConfiguration;
|
||||
import org.apache.cxf.jaxrs.client.WebClient;
|
||||
|
||||
|
||||
import com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* API tests for UserApi
|
||||
*/
|
||||
public class UserApiTest {
|
||||
|
||||
|
||||
private UserApi api;
|
||||
|
||||
@Before
|
||||
public void setup() {
|
||||
JacksonJsonProvider provider = new JacksonJsonProvider();
|
||||
List providers = new ArrayList();
|
||||
providers.add(provider);
|
||||
|
||||
api = JAXRSClientFactory.create("http://petstore.swagger.io/v2", UserApi.class, providers);
|
||||
org.apache.cxf.jaxrs.client.Client client = WebClient.client(api);
|
||||
|
||||
ClientConfiguration config = WebClient.getConfig(client);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Create user
|
||||
*
|
||||
* This can only be done by the logged in user.
|
||||
*
|
||||
* @throws ApiException
|
||||
* if the Api call fails
|
||||
*/
|
||||
@Test
|
||||
public void createUserTest() {
|
||||
User body = null;
|
||||
//api.createUser(body);
|
||||
|
||||
// TODO: test validations
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates list of users with given input array
|
||||
*
|
||||
*
|
||||
*
|
||||
* @throws ApiException
|
||||
* if the Api call fails
|
||||
*/
|
||||
@Test
|
||||
public void createUsersWithArrayInputTest() {
|
||||
List<User> body = null;
|
||||
//api.createUsersWithArrayInput(body);
|
||||
|
||||
// TODO: test validations
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates list of users with given input array
|
||||
*
|
||||
*
|
||||
*
|
||||
* @throws ApiException
|
||||
* if the Api call fails
|
||||
*/
|
||||
@Test
|
||||
public void createUsersWithListInputTest() {
|
||||
List<User> body = null;
|
||||
//api.createUsersWithListInput(body);
|
||||
|
||||
// TODO: test validations
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete user
|
||||
*
|
||||
* This can only be done by the logged in user.
|
||||
*
|
||||
* @throws ApiException
|
||||
* if the Api call fails
|
||||
*/
|
||||
@Test
|
||||
public void deleteUserTest() {
|
||||
String username = null;
|
||||
//api.deleteUser(username);
|
||||
|
||||
// TODO: test validations
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Get user by user name
|
||||
*
|
||||
*
|
||||
*
|
||||
* @throws ApiException
|
||||
* if the Api call fails
|
||||
*/
|
||||
@Test
|
||||
public void getUserByNameTest() {
|
||||
String username = null;
|
||||
//User response = api.getUserByName(username);
|
||||
//assertNotNull(response);
|
||||
// TODO: test validations
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Logs user into the system
|
||||
*
|
||||
*
|
||||
*
|
||||
* @throws ApiException
|
||||
* if the Api call fails
|
||||
*/
|
||||
@Test
|
||||
public void loginUserTest() {
|
||||
String username = null;
|
||||
String password = null;
|
||||
//String response = api.loginUser(username, password);
|
||||
//assertNotNull(response);
|
||||
// TODO: test validations
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Logs out current logged in user session
|
||||
*
|
||||
*
|
||||
*
|
||||
* @throws ApiException
|
||||
* if the Api call fails
|
||||
*/
|
||||
@Test
|
||||
public void logoutUserTest() {
|
||||
//api.logoutUser();
|
||||
|
||||
// TODO: test validations
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Updated user
|
||||
*
|
||||
* This can only be done by the logged in user.
|
||||
*
|
||||
* @throws ApiException
|
||||
* if the Api call fails
|
||||
*/
|
||||
@Test
|
||||
public void updateUserTest() {
|
||||
String username = null;
|
||||
User body = null;
|
||||
//api.updateUser(username, body);
|
||||
|
||||
// TODO: test validations
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user