Skip to content

Commit

Permalink
Merge branch 'update_java_server_samples'
Browse files Browse the repository at this point in the history
  • Loading branch information
wing328 committed Oct 9, 2017
2 parents 3b13431 + d054a43 commit 39ae041
Show file tree
Hide file tree
Showing 70 changed files with 1,410 additions and 59 deletions.
6 changes: 3 additions & 3 deletions samples/server/petstore/jaxrs-cxf-cdi/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"email" : "[email protected]"
},
"license" : {
"name" : "Apache 2.0",
"name" : "Apache-2.0",
"url" : "http://www.apache.org/licenses/LICENSE-2.0.html"
}
},
Expand Down Expand Up @@ -108,8 +108,8 @@
"type" : "array",
"items" : {
"type" : "string",
"enum" : [ "available", "pending", "sold" ],
"default" : "available"
"default" : "available",
"enum" : [ "available", "pending", "sold" ]
},
"collectionFormat" : "csv"
} ],
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
package io.swagger.api;

import io.swagger.model.Client;

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;
import io.swagger.annotations.ApiResponses;
import io.swagger.annotations.ApiResponse;
import io.swagger.jaxrs.PATCH;
import javax.validation.constraints.*;
import javax.validation.Valid;

@Path("/")
@Api(value = "/", description = "")
public interface AnotherFakeApi {

@PATCH
@Path("/another-fake/dummy")
@Consumes({ "application/json" })
@Produces({ "application/json" })
@ApiOperation(value = "To test special tags", tags={ "$another-fake?" })
@ApiResponses(value = {
@ApiResponse(code = 200, message = "successful operation", response = Client.class) })
public Client testSpecialTags(@Valid Client body);
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package io.swagger.api.impl;

import io.swagger.api.*;
import io.swagger.model.Client;

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 AnotherFakeApiServiceImpl implements AnotherFakeApi {
public Client testSpecialTags(Client body) {
// TODO: Implement...

return null;
}

}

Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
/**
* Swagger Petstore
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* OpenAPI spec version: 1.0.0
* Contact: [email protected]
*
* 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.Client;
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 AnotherFakeApi
*/
public class AnotherFakeApiTest {


private AnotherFakeApi api;

@Before
public void setup() {
JacksonJsonProvider provider = new JacksonJsonProvider();
List providers = new ArrayList();
providers.add(provider);

api = JAXRSClientFactory.create("http://petstore.swagger.io:80/v2", AnotherFakeApi.class, providers);
org.apache.cxf.jaxrs.client.Client client = WebClient.client(api);

ClientConfiguration config = WebClient.getConfig(client);
}


/**
* To test special tags
*
* To test special tags
*
* @throws ApiException
* if the Api call fails
*/
@Test
public void testSpecialTagsTest() {
Client body = null;
//Client response = api.testSpecialTags(body);
//assertNotNull(response);
// TODO: test validations


}

}
9 changes: 9 additions & 0 deletions samples/server/petstore/jaxrs-resteasy/eap-joda/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,15 @@
<build>
<sourceDirectory>src/main/java</sourceDirectory>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.6.1</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
Expand Down
9 changes: 9 additions & 0 deletions samples/server/petstore/jaxrs-resteasy/eap/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,15 @@
<build>
<sourceDirectory>src/main/java</sourceDirectory>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.6.1</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
Expand Down
18 changes: 9 additions & 9 deletions samples/server/petstore/jaxrs-spec-interface/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"email" : "[email protected]"
},
"license" : {
"name" : "Apache 2.0",
"name" : "Apache-2.0",
"url" : "http://www.apache.org/licenses/LICENSE-2.0.html"
}
},
Expand Down Expand Up @@ -108,8 +108,8 @@
"type" : "array",
"items" : {
"type" : "string",
"enum" : [ "available", "pending", "sold" ],
"default" : "available"
"default" : "available",
"enum" : [ "available", "pending", "sold" ]
},
"collectionFormat" : "csv"
} ],
Expand Down Expand Up @@ -680,8 +680,8 @@
"type" : "array",
"items" : {
"type" : "string",
"enum" : [ ">", "$" ],
"default" : "$"
"default" : "$",
"enum" : [ ">", "$" ]
}
}, {
"name" : "enum_form_string",
Expand All @@ -699,8 +699,8 @@
"type" : "array",
"items" : {
"type" : "string",
"enum" : [ ">", "$" ],
"default" : "$"
"default" : "$",
"enum" : [ ">", "$" ]
}
}, {
"name" : "enum_header_string",
Expand All @@ -718,8 +718,8 @@
"type" : "array",
"items" : {
"type" : "string",
"enum" : [ ">", "$" ],
"default" : "$"
"default" : "$",
"enum" : [ ">", "$" ]
}
}, {
"name" : "enum_query_string",
Expand Down
18 changes: 9 additions & 9 deletions samples/server/petstore/jaxrs-spec/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"email" : "[email protected]"
},
"license" : {
"name" : "Apache 2.0",
"name" : "Apache-2.0",
"url" : "http://www.apache.org/licenses/LICENSE-2.0.html"
}
},
Expand Down Expand Up @@ -108,8 +108,8 @@
"type" : "array",
"items" : {
"type" : "string",
"enum" : [ "available", "pending", "sold" ],
"default" : "available"
"default" : "available",
"enum" : [ "available", "pending", "sold" ]
},
"collectionFormat" : "csv"
} ],
Expand Down Expand Up @@ -680,8 +680,8 @@
"type" : "array",
"items" : {
"type" : "string",
"enum" : [ ">", "$" ],
"default" : "$"
"default" : "$",
"enum" : [ ">", "$" ]
}
}, {
"name" : "enum_form_string",
Expand All @@ -699,8 +699,8 @@
"type" : "array",
"items" : {
"type" : "string",
"enum" : [ ">", "$" ],
"default" : "$"
"default" : "$",
"enum" : [ ">", "$" ]
}
}, {
"name" : "enum_header_string",
Expand All @@ -718,8 +718,8 @@
"type" : "array",
"items" : {
"type" : "string",
"enum" : [ ">", "$" ],
"default" : "$"
"default" : "$",
"enum" : [ ">", "$" ]
}
}, {
"name" : "enum_query_string",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
package io.swagger.api;

import io.swagger.model.*;
import io.swagger.api.AnotherFakeApiService;
import io.swagger.api.factories.AnotherFakeApiServiceFactory;

import io.swagger.annotations.ApiParam;
import io.swagger.jaxrs.*;

import com.sun.jersey.multipart.FormDataParam;
import javax.validation.constraints.*;

import io.swagger.model.Client;

import java.util.Map;
import java.util.List;
import io.swagger.api.NotFoundException;

import java.io.InputStream;

import com.sun.jersey.core.header.FormDataContentDisposition;
import com.sun.jersey.multipart.FormDataParam;

import javax.ws.rs.core.Context;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.SecurityContext;
import javax.ws.rs.*;

@Path("/AnotherFake")


@io.swagger.annotations.Api(description = "the AnotherFake API")

public class AnotherFakeApi {
private final AnotherFakeApiService delegate = AnotherFakeApiServiceFactory.getAnotherFakeApi();

@PATCH

@Consumes({ "application/json" })
@Produces({ "application/json" })
@io.swagger.annotations.ApiOperation(value = "To test special tags", notes = "To test special tags", response = Client.class, tags={ "$another-fake?" })
@io.swagger.annotations.ApiResponses(value = {
@io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Client.class) })
public Response testSpecialTags(
@ApiParam(value = "client model" ,required=true) Client body,
@Context SecurityContext securityContext)
throws NotFoundException {
return delegate.testSpecialTags(body,securityContext);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package io.swagger.api;

import io.swagger.api.*;
import io.swagger.model.*;

import com.sun.jersey.multipart.FormDataParam;

import io.swagger.model.Client;

import java.util.List;
import io.swagger.api.NotFoundException;

import java.io.InputStream;

import com.sun.jersey.core.header.FormDataContentDisposition;
import com.sun.jersey.multipart.FormDataParam;

import javax.ws.rs.core.Response;
import javax.ws.rs.core.SecurityContext;
import javax.validation.constraints.*;

public abstract class AnotherFakeApiService {
public abstract Response testSpecialTags(Client body,SecurityContext securityContext)
throws NotFoundException;
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public void init(ServletConfig config) throws ServletException {
.contact(new Contact()
.email("[email protected]"))
.license(new License()
.name("Apache 2.0")
.name("Apache-2.0")
.url("http://www.apache.org/licenses/LICENSE-2.0.html"));

ServletContext context = config.getServletContext();
Expand Down
Loading

0 comments on commit 39ae041

Please sign in to comment.