diff --git a/pom.xml b/pom.xml
index 13cfee6ca66..24bd8f8a455 100644
--- a/pom.xml
+++ b/pom.xml
@@ -277,6 +277,19 @@
+
+
+ samples
+
+
+ env
+ samples
+
+
+
+ samples/client/petstore/objc
+
+
modules/swagger-codegen
diff --git a/samples/client/petstore/objc/PetstoreClient/PetstoreClient.xcodeproj/project.pbxproj b/samples/client/petstore/objc/PetstoreClient/PetstoreClient.xcodeproj/project.pbxproj
index 349c3f59a88..66a244ebf3a 100644
--- a/samples/client/petstore/objc/PetstoreClient/PetstoreClient.xcodeproj/project.pbxproj
+++ b/samples/client/petstore/objc/PetstoreClient/PetstoreClient.xcodeproj/project.pbxproj
@@ -22,7 +22,8 @@
EA6699BD1811D2FB00A70D03 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = EA6699991811D2FA00A70D03 /* Foundation.framework */; };
EA6699BE1811D2FB00A70D03 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = EA66999D1811D2FA00A70D03 /* UIKit.framework */; };
EA6699C61811D2FB00A70D03 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = EA6699C41811D2FB00A70D03 /* InfoPlist.strings */; };
- EA6699C81811D2FB00A70D03 /* PetstoreClientTests.m in Sources */ = {isa = PBXBuildFile; fileRef = EA6699C71811D2FB00A70D03 /* PetstoreClientTests.m */; };
+ EA6699C81811D2FB00A70D03 /* PetApiTest.m in Sources */ = {isa = PBXBuildFile; fileRef = EA6699C71811D2FB00A70D03 /* PetApiTest.m */; };
+ EA8CD3ED1AC2763600C47D0B /* SenTestingKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = EA8CD3EC1AC2763600C47D0B /* SenTestingKit.framework */; };
EAEA85E41811D3AE00F06E69 /* SWGApiClient.m in Sources */ = {isa = PBXBuildFile; fileRef = EAEA85CD1811D3AE00F06E69 /* SWGApiClient.m */; };
EAEA85E51811D3AE00F06E69 /* SWGCategory.m in Sources */ = {isa = PBXBuildFile; fileRef = EAEA85CF1811D3AE00F06E69 /* SWGCategory.m */; };
EAEA85E61811D3AE00F06E69 /* SWGDate.m in Sources */ = {isa = PBXBuildFile; fileRef = EAEA85D11811D3AE00F06E69 /* SWGDate.m */; };
@@ -73,7 +74,9 @@
EA6699BB1811D2FB00A70D03 /* XCTest.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = XCTest.framework; path = Library/Frameworks/XCTest.framework; sourceTree = DEVELOPER_DIR; };
EA6699C31811D2FB00A70D03 /* PetstoreClientTests-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "PetstoreClientTests-Info.plist"; sourceTree = ""; };
EA6699C51811D2FB00A70D03 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; };
- EA6699C71811D2FB00A70D03 /* PetstoreClientTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = PetstoreClientTests.m; sourceTree = ""; };
+ EA6699C71811D2FB00A70D03 /* PetApiTest.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = PetApiTest.m; sourceTree = ""; };
+ EA8CD3EB1AC274BE00C47D0B /* PetApiTest.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PetApiTest.h; sourceTree = ""; };
+ EA8CD3EC1AC2763600C47D0B /* SenTestingKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SenTestingKit.framework; path = Library/Frameworks/SenTestingKit.framework; sourceTree = DEVELOPER_DIR; };
EAEA85CC1811D3AE00F06E69 /* SWGApiClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SWGApiClient.h; sourceTree = ""; };
EAEA85CD1811D3AE00F06E69 /* SWGApiClient.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SWGApiClient.m; sourceTree = ""; };
EAEA85CE1811D3AE00F06E69 /* SWGCategory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SWGCategory.h; sourceTree = ""; };
@@ -120,6 +123,7 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
+ EA8CD3ED1AC2763600C47D0B /* SenTestingKit.framework in Frameworks */,
EAEA85F11811D8F100F06E69 /* libPods.a in Frameworks */,
EA6699BC1811D2FB00A70D03 /* XCTest.framework in Frameworks */,
EA6699BE1811D2FB00A70D03 /* UIKit.framework in Frameworks */,
@@ -163,6 +167,7 @@
EA6699981811D2FA00A70D03 /* Frameworks */ = {
isa = PBXGroup;
children = (
+ EA8CD3EC1AC2763600C47D0B /* SenTestingKit.framework */,
EAEA85F01811D8F100F06E69 /* libPods.a */,
EA6699991811D2FA00A70D03 /* Foundation.framework */,
EA66999B1811D2FA00A70D03 /* CoreGraphics.framework */,
@@ -203,7 +208,8 @@
EA6699C11811D2FB00A70D03 /* PetstoreClientTests */ = {
isa = PBXGroup;
children = (
- EA6699C71811D2FB00A70D03 /* PetstoreClientTests.m */,
+ EA8CD3EB1AC274BE00C47D0B /* PetApiTest.h */,
+ EA6699C71811D2FB00A70D03 /* PetApiTest.m */,
EA6699C21811D2FB00A70D03 /* Supporting Files */,
);
path = PetstoreClientTests;
@@ -409,7 +415,7 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
- EA6699C81811D2FB00A70D03 /* PetstoreClientTests.m in Sources */,
+ EA6699C81811D2FB00A70D03 /* PetApiTest.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
diff --git a/samples/client/petstore/objc/PetstoreClient/PetstoreClient.xcodeproj/xcuserdata/tony.xcuserdatad/xcschemes/PetstoreClient.xcscheme b/samples/client/petstore/objc/PetstoreClient/PetstoreClient.xcodeproj/xcuserdata/tony.xcuserdatad/xcschemes/PetstoreClient.xcscheme
index 00830cf82b3..fd55bb26268 100644
--- a/samples/client/petstore/objc/PetstoreClient/PetstoreClient.xcodeproj/xcuserdata/tony.xcuserdatad/xcschemes/PetstoreClient.xcscheme
+++ b/samples/client/petstore/objc/PetstoreClient/PetstoreClient.xcodeproj/xcuserdata/tony.xcuserdatad/xcschemes/PetstoreClient.xcscheme
@@ -58,7 +58,8 @@
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
allowLocationSimulation = "YES">
-
+
-
+
+#import "SWGPetApi.h"
+
+@interface PetApiTest : XCTestCase {
+@private
+ SWGPetApi * api;
+}
+
+@end
\ No newline at end of file
diff --git a/samples/client/petstore/objc/PetstoreClient/PetstoreClientTests/PetApiTest.m b/samples/client/petstore/objc/PetstoreClient/PetstoreClientTests/PetApiTest.m
new file mode 100644
index 00000000000..0859bccf37d
--- /dev/null
+++ b/samples/client/petstore/objc/PetstoreClient/PetstoreClientTests/PetApiTest.m
@@ -0,0 +1,181 @@
+#import "PetApiTest.h"
+#import "SWGFile.h"
+
+@implementation PetApiTest
+
+- (void)setUp {
+ [super setUp];
+ api = [[SWGPetApi alloc ]init];
+ [SWGPetApi setBasePath:@"http://localhost:8002/api"];
+}
+
+- (void)tearDown {
+ [super tearDown];
+}
+
+- (void)testGetPetById {
+ [api getPetByIdWithCompletionBlock:@1 completionHandler:^(SWGPet *output, NSError *error) {
+ if(error){
+ XCTFail(@"got error %@", error);
+ }
+ if(output){
+ XCTAssertNotNil([output _id], @"token was nil");
+ }
+ }];
+}
+
+- (void) testAddPet {
+ SWGPet * petToAdd = [[SWGPet alloc] init];
+ [petToAdd set_id:@1000];
+ NSMutableArray* tags = [[NSMutableArray alloc] init];
+ for(int i = 0; i < 5; i++){
+ SWGTag * tag = [[SWGTag alloc] init];
+ [tag set_id:[NSNumber numberWithInt:i]];
+ [tag setName:[NSString stringWithFormat:@"tag-%d", i]];
+ [tags addObject:tag];
+ }
+ [petToAdd setTags:tags];
+ [petToAdd setStatus:@"lost"];
+
+ SWGCategory * category = [[SWGCategory alloc] init];
+ [category setName:@"sold"];
+ [petToAdd setCategory:category];
+ [petToAdd setName:@"dragon"];
+
+ NSMutableArray* photos = [[NSMutableArray alloc] init];
+ for(int i = 0; i < 10; i++){
+ NSString * url = [NSString stringWithFormat:@"http://foo.com/photo/%d", i];
+ [photos addObject:url];
+ }
+ [petToAdd setPhotoUrls:photos];
+
+ [api addPetWithCompletionBlock:petToAdd completionHandler:^(NSError *error) {
+ if(error){
+ XCTFail(@"got error %@", error);
+ }
+ }];
+}
+
+- (void) testUpdatePet {
+ SWGPet * petToAdd = [[SWGPet alloc] init];
+ [petToAdd set_id:[NSNumber numberWithInt:1000]];
+ NSMutableArray* tags = [[NSMutableArray alloc] init];
+ for(int i = 0; i < 5; i++){
+ SWGTag * tag = [[SWGTag alloc] init];
+ [tag set_id:[NSNumber numberWithInt:i]];
+ [tag setName:[NSString stringWithFormat:@"tag-%d", i]];
+ [tags addObject:tag];
+ }
+ [petToAdd setTags:tags];
+ [petToAdd setStatus:@"lost"];
+
+ SWGCategory * category = [[SWGCategory alloc] init];
+ [category setName:@"sold"];
+ [petToAdd setCategory:category];
+ [petToAdd setName:@"dragon"];
+
+ NSMutableArray* photos = [[NSMutableArray alloc] init];
+ for(int i = 0; i < 10; i++){
+ NSString * url = [NSString stringWithFormat:@"http://foo.com/photo/%d", i];
+ [photos addObject:url];
+ }
+ [petToAdd setPhotoUrls:photos];
+
+ static bool hasResponse = false;
+ [api addPetWithCompletionBlock:petToAdd completionHandler:^(NSError *error) {
+ if(error) {
+ XCTFail(@"got error %@", error);
+ }
+ else {
+ [api getPetByIdWithCompletionBlock:[NSString stringWithFormat:@"%@",[petToAdd _id]] completionHandler:^(SWGPet *output, NSError *error) {
+ if(error) {
+ XCTFail(@"got error %@", error);
+ }
+ if(output == nil){
+ NSLog(@"failed to fetch pet");
+ }
+ else {
+ SWGPet* pet = [[SWGPet alloc] initWithValues:[output asDictionary]];
+ NSLog(@"got the pet");
+
+ [pet setName:@"programmer"];
+ [pet setStatus:@"confused"];
+
+ [api updatePetWithCompletionBlock:pet
+ completionHandler:^(NSError *error) {
+ if(error) {
+ XCTFail(@"got error %@", error);
+ }
+ [api getPetByIdWithCompletionBlock:@1000 completionHandler:^(SWGPet *output, NSError *error) {
+ if(error) {
+ XCTFail(@"got error %@", error);
+ }
+ if(output == nil){
+ NSLog(@"failed to fetch pet");
+ }
+ else {
+ SWGPet* pet = [[SWGPet alloc] initWithValues:[output asDictionary]];
+ XCTAssertNotNil([pet _id], @"pet was nil");
+ XCTAssertEqualObjects([pet name], @"programmer", @"pet name was not updated");
+ XCTAssertEqualObjects([pet status], @"confused", @"pet status was not updated");
+ }
+ }];
+ }];
+ }
+ }];
+ }
+ }];
+}
+
+- (void)testGetPetByStatus {
+ bool done = false;
+ static NSMutableArray* pets = nil;
+ static NSError * gError = nil;
+ [api findPetsByStatusWithCompletionBlock:@"available" completionHandler:^(NSArray *output, NSError *error) {
+ if(error) {
+ gError = error;
+ }
+ if(output == nil){
+ NSLog(@"failed to fetch pets");
+ }
+ else {
+ pets = [[NSMutableArray alloc]init];
+ for(SWGPet* pet in output) {
+ [pets addObject:[[SWGPet alloc] initWithValues:[pet asDictionary]]];
+ }
+ }
+ }];
+ NSDate * loopUntil = [NSDate dateWithTimeIntervalSinceNow:10];
+ while(!done && [loopUntil timeIntervalSinceNow] > 0){
+ if(gError){
+ XCTFail(@"got error %@", gError);
+ done = true;
+ }
+ if(pets){
+ for(SWGPet * pet in pets) {
+ XCTAssertEqualObjects([pet status], @"available", @"got invalid status for pets");
+ }
+ done = true;
+ }
+ }
+}
+
+- (void)testGetPetByTags {
+ [api findPetsByTagsWithCompletionBlock:@"tag1,tag2" completionHandler:^(NSArray *output, NSError *error) {
+ if(error){
+ XCTFail(@"got error %@", error);
+ }
+ if(output){
+ for(SWGPet * pet in output) {
+ bool hasTag = false;
+ for(SWGTag * tag in [pet tags]){
+ if([[tag name] isEqualToString:@"tag1"] || [[tag name] isEqualToString:@"tag2"])
+ hasTag = true;
+ }
+ if(!hasTag)
+ XCTFail(@"failed to find tag in pet");
+ }
+ }
+ }];
+}
+@end
\ No newline at end of file
diff --git a/samples/client/petstore/objc/PetstoreClient/PetstoreClientTests/PetstoreClientTests.m b/samples/client/petstore/objc/PetstoreClient/PetstoreClientTests/PetstoreClientTests.m
deleted file mode 100644
index f523807b470..00000000000
--- a/samples/client/petstore/objc/PetstoreClient/PetstoreClientTests/PetstoreClientTests.m
+++ /dev/null
@@ -1,34 +0,0 @@
-//
-// PetstoreClientTests.m
-// PetstoreClientTests
-//
-// Created by Tony Tam on 10/18/13.
-// Copyright (c) 2013 Reverb. All rights reserved.
-//
-
-#import
-
-@interface PetstoreClientTests : XCTestCase
-
-@end
-
-@implementation PetstoreClientTests
-
-- (void)setUp
-{
- [super setUp];
- // Put setup code here. This method is called before the invocation of each test method in the class.
-}
-
-- (void)tearDown
-{
- // Put teardown code here. This method is called after the invocation of each test method in the class.
- [super tearDown];
-}
-
-- (void)testExample
-{
- XCTFail(@"No implementation for \"%s\"", __PRETTY_FUNCTION__);
-}
-
-@end
diff --git a/samples/client/petstore/objc/PetstoreClient/pom.xml b/samples/client/petstore/objc/PetstoreClient/pom.xml
new file mode 100644
index 00000000000..513976e90b0
--- /dev/null
+++ b/samples/client/petstore/objc/PetstoreClient/pom.xml
@@ -0,0 +1,24 @@
+
+ 4.0.0
+ de.felixschulze.my-project
+ PetstoreClient
+ xcode
+ 1.0-SNAPSHOT
+ Swagger Petstore Client
+
+
+
+ de.felixschulze.maven.plugins.xcode
+ xcode-maven-plugin
+ 1.2
+
+ PetstoreClient.xcodeproj
+ PetstoreClient
+ Debug
+ iphoneos
+
+ true
+
+
+
+