Add java microprofile samples

This commit is contained in:
William Cheng
2019-12-10 11:53:23 +08:00
parent ca9313881a
commit f22f6a40a1
20 changed files with 2557 additions and 0 deletions

View File

@@ -0,0 +1,204 @@
/**
* OpenAPI Petstore
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* 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 org.openapitools.client.api;
import java.io.File;
import org.openapitools.client.model.ModelApiResponse;
import org.openapitools.client.model.Pet;
import org.junit.Test;
import org.junit.Before;
import static org.junit.Assert.*;
import org.eclipse.microprofile.rest.client.RestClientBuilder;
import java.net.URL;
import java.net.MalformedURLException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* OpenAPI Petstore Test
*
* API tests for PetApi
*/
public class PetApiTest {
private PetApi client;
private String baseUrl = "http://localhost:9080";
@Before
public void setup() throws MalformedURLException {
client = RestClientBuilder.newBuilder()
.baseUrl(new URL(baseUrl))
.register(ApiException.class)
.build(PetApi.class);
}
/**
* Add a new pet to the store
*
* @throws ApiException
* if the Api call fails
*/
@Test
public void addPetTest() {
// TODO: test validations
Pet body = null;
//void response = api.addPet(body);
//assertNotNull(response);
}
/**
* Deletes a pet
*
* @throws ApiException
* if the Api call fails
*/
@Test
public void deletePetTest() {
// TODO: test validations
Long petId = null;
String apiKey = null;
//void response = api.deletePet(petId, apiKey);
//assertNotNull(response);
}
/**
* 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() {
// TODO: test validations
List<String> status = null;
//List<Pet> response = api.findPetsByStatus(status);
//assertNotNull(response);
}
/**
* 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() {
// TODO: test validations
List<String> tags = null;
//List<Pet> response = api.findPetsByTags(tags);
//assertNotNull(response);
}
/**
* Find pet by ID
*
* Returns a single pet
*
* @throws ApiException
* if the Api call fails
*/
@Test
public void getPetByIdTest() {
// TODO: test validations
Long petId = null;
//Pet response = api.getPetById(petId);
//assertNotNull(response);
}
/**
* Update an existing pet
*
* @throws ApiException
* if the Api call fails
*/
@Test
public void updatePetTest() {
// TODO: test validations
Pet body = null;
//void response = api.updatePet(body);
//assertNotNull(response);
}
/**
* Updates a pet in the store with form data
*
* @throws ApiException
* if the Api call fails
*/
@Test
public void updatePetWithFormTest() {
// TODO: test validations
Long petId = null;
String name = null;
String status = null;
//void response = api.updatePetWithForm(petId, name, status);
//assertNotNull(response);
}
/**
* uploads an image
*
* @throws ApiException
* if the Api call fails
*/
@Test
public void uploadFileTest() {
// TODO: test validations
Long petId = null;
String additionalMetadata = null;
org.apache.cxf.jaxrs.ext.multipart.Attachment file = null;
//ModelApiResponse response = api.uploadFile(petId, additionalMetadata, file);
//assertNotNull(response);
}
}

View File

@@ -0,0 +1,132 @@
/**
* OpenAPI Petstore
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* 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 org.openapitools.client.api;
import org.openapitools.client.model.Order;
import org.junit.Test;
import org.junit.Before;
import static org.junit.Assert.*;
import org.eclipse.microprofile.rest.client.RestClientBuilder;
import java.net.URL;
import java.net.MalformedURLException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* OpenAPI Petstore Test
*
* API tests for StoreApi
*/
public class StoreApiTest {
private StoreApi client;
private String baseUrl = "http://localhost:9080";
@Before
public void setup() throws MalformedURLException {
client = RestClientBuilder.newBuilder()
.baseUrl(new URL(baseUrl))
.register(ApiException.class)
.build(StoreApi.class);
}
/**
* Delete purchase order by ID
*
* For valid response try integer IDs with value &lt; 1000. Anything above 1000 or nonintegers will generate API errors
*
* @throws ApiException
* if the Api call fails
*/
@Test
public void deleteOrderTest() {
// TODO: test validations
String orderId = null;
//void response = api.deleteOrder(orderId);
//assertNotNull(response);
}
/**
* Returns pet inventories by status
*
* Returns a map of status codes to quantities
*
* @throws ApiException
* if the Api call fails
*/
@Test
public void getInventoryTest() {
// TODO: test validations
//Map<String, Integer> response = api.getInventory();
//assertNotNull(response);
}
/**
* Find purchase order by ID
*
* For valid response try integer IDs with value &lt;&#x3D; 5 or &gt; 10. Other values will generated exceptions
*
* @throws ApiException
* if the Api call fails
*/
@Test
public void getOrderByIdTest() {
// TODO: test validations
Long orderId = null;
//Order response = api.getOrderById(orderId);
//assertNotNull(response);
}
/**
* Place an order for a pet
*
* @throws ApiException
* if the Api call fails
*/
@Test
public void placeOrderTest() {
// TODO: test validations
Order body = null;
//Order response = api.placeOrder(body);
//assertNotNull(response);
}
}

View File

@@ -0,0 +1,198 @@
/**
* OpenAPI Petstore
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* 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 org.openapitools.client.api;
import org.openapitools.client.model.User;
import org.junit.Test;
import org.junit.Before;
import static org.junit.Assert.*;
import org.eclipse.microprofile.rest.client.RestClientBuilder;
import java.net.URL;
import java.net.MalformedURLException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* OpenAPI Petstore Test
*
* API tests for UserApi
*/
public class UserApiTest {
private UserApi client;
private String baseUrl = "http://localhost:9080";
@Before
public void setup() throws MalformedURLException {
client = RestClientBuilder.newBuilder()
.baseUrl(new URL(baseUrl))
.register(ApiException.class)
.build(UserApi.class);
}
/**
* Create user
*
* This can only be done by the logged in user.
*
* @throws ApiException
* if the Api call fails
*/
@Test
public void createUserTest() {
// TODO: test validations
User body = null;
//void response = api.createUser(body);
//assertNotNull(response);
}
/**
* Creates list of users with given input array
*
* @throws ApiException
* if the Api call fails
*/
@Test
public void createUsersWithArrayInputTest() {
// TODO: test validations
List<User> body = null;
//void response = api.createUsersWithArrayInput(body);
//assertNotNull(response);
}
/**
* Creates list of users with given input array
*
* @throws ApiException
* if the Api call fails
*/
@Test
public void createUsersWithListInputTest() {
// TODO: test validations
List<User> body = null;
//void response = api.createUsersWithListInput(body);
//assertNotNull(response);
}
/**
* Delete user
*
* This can only be done by the logged in user.
*
* @throws ApiException
* if the Api call fails
*/
@Test
public void deleteUserTest() {
// TODO: test validations
String username = null;
//void response = api.deleteUser(username);
//assertNotNull(response);
}
/**
* Get user by user name
*
* @throws ApiException
* if the Api call fails
*/
@Test
public void getUserByNameTest() {
// TODO: test validations
String username = null;
//User response = api.getUserByName(username);
//assertNotNull(response);
}
/**
* Logs user into the system
*
* @throws ApiException
* if the Api call fails
*/
@Test
public void loginUserTest() {
// TODO: test validations
String username = null;
String password = null;
//String response = api.loginUser(username, password);
//assertNotNull(response);
}
/**
* Logs out current logged in user session
*
* @throws ApiException
* if the Api call fails
*/
@Test
public void logoutUserTest() {
// TODO: test validations
//void response = api.logoutUser();
//assertNotNull(response);
}
/**
* Updated user
*
* This can only be done by the logged in user.
*
* @throws ApiException
* if the Api call fails
*/
@Test
public void updateUserTest() {
// TODO: test validations
String username = null;
User body = null;
//void response = api.updateUser(username, body);
//assertNotNull(response);
}
}

View File

@@ -0,0 +1,63 @@
/**
* OpenAPI Petstore
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* 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 org.openapitools.client.model;
import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;
/**
* Model tests for Category
*/
public class CategoryTest {
private final Category model = new Category();
/**
* Model tests for Category
*/
@Test
public void testCategory() {
// TODO: test Category
}
/**
* Test the property 'id'
*/
@Test
public void idTest() {
// TODO: test id
}
/**
* Test the property 'name'
*/
@Test
public void nameTest() {
// TODO: test name
}
}

View File

@@ -0,0 +1,71 @@
/**
* OpenAPI Petstore
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* 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 org.openapitools.client.model;
import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;
/**
* Model tests for ModelApiResponse
*/
public class ModelApiResponseTest {
private final ModelApiResponse model = new ModelApiResponse();
/**
* Model tests for ModelApiResponse
*/
@Test
public void testModelApiResponse() {
// TODO: test ModelApiResponse
}
/**
* Test the property 'code'
*/
@Test
public void codeTest() {
// TODO: test code
}
/**
* Test the property 'type'
*/
@Test
public void typeTest() {
// TODO: test type
}
/**
* Test the property 'message'
*/
@Test
public void messageTest() {
// TODO: test message
}
}

View File

@@ -0,0 +1,96 @@
/**
* OpenAPI Petstore
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* 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 org.openapitools.client.model;
import java.util.Date;
import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;
/**
* Model tests for Order
*/
public class OrderTest {
private final Order model = new Order();
/**
* Model tests for Order
*/
@Test
public void testOrder() {
// TODO: test Order
}
/**
* Test the property 'id'
*/
@Test
public void idTest() {
// TODO: test id
}
/**
* Test the property 'petId'
*/
@Test
public void petIdTest() {
// TODO: test petId
}
/**
* Test the property 'quantity'
*/
@Test
public void quantityTest() {
// TODO: test quantity
}
/**
* Test the property 'shipDate'
*/
@Test
public void shipDateTest() {
// TODO: test shipDate
}
/**
* Test the property 'status'
*/
@Test
public void statusTest() {
// TODO: test status
}
/**
* Test the property 'complete'
*/
@Test
public void completeTest() {
// TODO: test complete
}
}

View File

@@ -0,0 +1,99 @@
/**
* OpenAPI Petstore
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* 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 org.openapitools.client.model;
import java.util.ArrayList;
import java.util.List;
import org.openapitools.client.model.Category;
import org.openapitools.client.model.Tag;
import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;
/**
* Model tests for Pet
*/
public class PetTest {
private final Pet model = new Pet();
/**
* Model tests for Pet
*/
@Test
public void testPet() {
// TODO: test Pet
}
/**
* Test the property 'id'
*/
@Test
public void idTest() {
// TODO: test id
}
/**
* Test the property 'category'
*/
@Test
public void categoryTest() {
// TODO: test category
}
/**
* Test the property 'name'
*/
@Test
public void nameTest() {
// TODO: test name
}
/**
* Test the property 'photoUrls'
*/
@Test
public void photoUrlsTest() {
// TODO: test photoUrls
}
/**
* Test the property 'tags'
*/
@Test
public void tagsTest() {
// TODO: test tags
}
/**
* Test the property 'status'
*/
@Test
public void statusTest() {
// TODO: test status
}
}

View File

@@ -0,0 +1,63 @@
/**
* OpenAPI Petstore
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* 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 org.openapitools.client.model;
import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;
/**
* Model tests for Tag
*/
public class TagTest {
private final Tag model = new Tag();
/**
* Model tests for Tag
*/
@Test
public void testTag() {
// TODO: test Tag
}
/**
* Test the property 'id'
*/
@Test
public void idTest() {
// TODO: test id
}
/**
* Test the property 'name'
*/
@Test
public void nameTest() {
// TODO: test name
}
}

View File

@@ -0,0 +1,111 @@
/**
* OpenAPI Petstore
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* 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 org.openapitools.client.model;
import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;
/**
* Model tests for User
*/
public class UserTest {
private final User model = new User();
/**
* Model tests for User
*/
@Test
public void testUser() {
// TODO: test User
}
/**
* Test the property 'id'
*/
@Test
public void idTest() {
// TODO: test id
}
/**
* Test the property 'username'
*/
@Test
public void usernameTest() {
// TODO: test username
}
/**
* Test the property 'firstName'
*/
@Test
public void firstNameTest() {
// TODO: test firstName
}
/**
* Test the property 'lastName'
*/
@Test
public void lastNameTest() {
// TODO: test lastName
}
/**
* Test the property 'email'
*/
@Test
public void emailTest() {
// TODO: test email
}
/**
* Test the property 'password'
*/
@Test
public void passwordTest() {
// TODO: test password
}
/**
* Test the property 'phone'
*/
@Test
public void phoneTest() {
// TODO: test phone
}
/**
* Test the property 'userStatus'
*/
@Test
public void userStatusTest() {
// TODO: test userStatus
}
}