forked from loafle/openapi-generator-original
		
	fixed test errors
This commit is contained in:
		
							parent
							
								
									ceffa10ab7
								
							
						
					
					
						commit
						be373f88d4
					
				@ -6,6 +6,7 @@
 | 
			
		||||
- (void)setUp {
 | 
			
		||||
    [super setUp];
 | 
			
		||||
    api = [[SWGPetApi alloc ]init];
 | 
			
		||||
//    [[SWGApiClient sharedClientFromPool]setLoggingEnabled:true];
 | 
			
		||||
    [SWGPetApi setBasePath:@"http://localhost:8002/api"];
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -14,6 +15,7 @@
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
- (void)testGetPetById {
 | 
			
		||||
    XCTestExpectation *expectation = [self expectationWithDescription:@"testGetPetById"];
 | 
			
		||||
    [api getPetByIdWithCompletionBlock:@1 completionHandler:^(SWGPet *output, NSError *error) {
 | 
			
		||||
        if(error){
 | 
			
		||||
            XCTFail(@"got error %@", error);
 | 
			
		||||
@ -21,10 +23,14 @@
 | 
			
		||||
        if(output){
 | 
			
		||||
            XCTAssertNotNil([output _id], @"token was nil");
 | 
			
		||||
        }
 | 
			
		||||
        [expectation fulfill];
 | 
			
		||||
    }];
 | 
			
		||||
    [self waitForExpectationsWithTimeout:2.0 handler:nil];
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
- (void) testAddPet {
 | 
			
		||||
    XCTestExpectation *expectation = [self expectationWithDescription:@"testAddPet"];
 | 
			
		||||
    
 | 
			
		||||
    SWGPet * petToAdd = [[SWGPet alloc] init];
 | 
			
		||||
    [petToAdd set_id:@1000];
 | 
			
		||||
    NSMutableArray* tags = [[NSMutableArray alloc] init];
 | 
			
		||||
@ -53,10 +59,14 @@
 | 
			
		||||
        if(error){
 | 
			
		||||
            XCTFail(@"got error %@", error);
 | 
			
		||||
        }
 | 
			
		||||
        [expectation fulfill];
 | 
			
		||||
    }];
 | 
			
		||||
    
 | 
			
		||||
    [self waitForExpectationsWithTimeout:2.0 handler:nil];
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
- (void) testUpdatePet {
 | 
			
		||||
    XCTestExpectation *expectation = [self expectationWithDescription:@"testUpdatePet"];
 | 
			
		||||
    SWGPet * petToAdd = [[SWGPet alloc] init];
 | 
			
		||||
    [petToAdd set_id:[NSNumber numberWithInt:1000]];
 | 
			
		||||
    NSMutableArray* tags = [[NSMutableArray alloc] init];
 | 
			
		||||
@ -80,6 +90,7 @@
 | 
			
		||||
        [photos addObject:url];
 | 
			
		||||
    }
 | 
			
		||||
    [petToAdd setPhotoUrls:photos];
 | 
			
		||||
    dispatch_semaphore_t sema = dispatch_semaphore_create(0);
 | 
			
		||||
 | 
			
		||||
    static bool hasResponse = false;
 | 
			
		||||
    [api addPetWithCompletionBlock:petToAdd completionHandler:^(NSError *error) {
 | 
			
		||||
@ -119,16 +130,19 @@
 | 
			
		||||
                                                XCTAssertEqualObjects([pet name], @"programmer", @"pet name was not updated");
 | 
			
		||||
                                                XCTAssertEqualObjects([pet status], @"confused", @"pet status was not updated");
 | 
			
		||||
                                            }
 | 
			
		||||
                                            [expectation fulfill];
 | 
			
		||||
 | 
			
		||||
                                        }];
 | 
			
		||||
                                    }];
 | 
			
		||||
                }
 | 
			
		||||
            }];
 | 
			
		||||
        }
 | 
			
		||||
    }];
 | 
			
		||||
    [self waitForExpectationsWithTimeout:2.0 handler:nil];
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
- (void)testGetPetByStatus {
 | 
			
		||||
    bool done = false;
 | 
			
		||||
    XCTestExpectation *expectation = [self expectationWithDescription:@"testGetPetByStatus"];
 | 
			
		||||
    static NSMutableArray* pets = nil;
 | 
			
		||||
    static NSError * gError = nil;
 | 
			
		||||
    [api findPetsByStatusWithCompletionBlock:@"available" completionHandler:^(NSArray *output, NSError *error) {
 | 
			
		||||
@ -145,22 +159,11 @@
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    }];
 | 
			
		||||
    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;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
    [self waitForExpectationsWithTimeout:2.0 handler:nil];
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
- (void)testGetPetByTags {
 | 
			
		||||
    XCTestExpectation *expectation = [self expectationWithDescription:@"testGetPetByTags"];
 | 
			
		||||
    [api findPetsByTagsWithCompletionBlock:@"tag1,tag2" completionHandler:^(NSArray *output, NSError *error) {
 | 
			
		||||
        if(error){
 | 
			
		||||
            XCTFail(@"got error %@", error);
 | 
			
		||||
@ -176,6 +179,8 @@
 | 
			
		||||
                    XCTFail(@"failed to find tag in pet");
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        [expectation fulfill];
 | 
			
		||||
    }];
 | 
			
		||||
    [self waitForExpectationsWithTimeout:2.0 handler:nil];
 | 
			
		||||
}
 | 
			
		||||
@end
 | 
			
		||||
							
								
								
									
										128
									
								
								samples/client/petstore/objc/pom.xml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										128
									
								
								samples/client/petstore/objc/pom.xml
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,128 @@
 | 
			
		||||
<project>
 | 
			
		||||
  <modelVersion>4.0.0</modelVersion>
 | 
			
		||||
  <groupId>de.felixschulze.my-project</groupId>
 | 
			
		||||
  <artifactId>PetstoreClient</artifactId>
 | 
			
		||||
  <packaging>pom</packaging>
 | 
			
		||||
  <version>1.0-SNAPSHOT</version>
 | 
			
		||||
  <name>Objective-C Swagger Petstore Client</name>
 | 
			
		||||
  <build>
 | 
			
		||||
    <plugins>
 | 
			
		||||
      <plugin>
 | 
			
		||||
        <artifactId>maven-dependency-plugin</artifactId>
 | 
			
		||||
        <executions>
 | 
			
		||||
          <execution>
 | 
			
		||||
            <phase>package</phase>
 | 
			
		||||
            <goals>
 | 
			
		||||
              <goal>copy-dependencies</goal>
 | 
			
		||||
            </goals>
 | 
			
		||||
            <configuration>
 | 
			
		||||
              <outputDirectory>${project.build.directory}</outputDirectory>
 | 
			
		||||
            </configuration>
 | 
			
		||||
          </execution>
 | 
			
		||||
        </executions>
 | 
			
		||||
      </plugin>
 | 
			
		||||
      <plugin>
 | 
			
		||||
        <groupId>org.mortbay.jetty</groupId>
 | 
			
		||||
        <artifactId>jetty-maven-plugin</artifactId>
 | 
			
		||||
        <version>${jetty-version}</version>
 | 
			
		||||
        <configuration>
 | 
			
		||||
          <useTestScope>true</useTestScope>
 | 
			
		||||
          <stopWait>15</stopWait>
 | 
			
		||||
          <war>${project.build.directory}/swagger-java-jersey-sample-app-${webapp-version}.war</war>
 | 
			
		||||
          <webAppConfig>
 | 
			
		||||
            <contextPath>/</contextPath>
 | 
			
		||||
          </webAppConfig>
 | 
			
		||||
          <stopPort>8079</stopPort>
 | 
			
		||||
          <stopKey>stopit</stopKey>
 | 
			
		||||
          <connectors>
 | 
			
		||||
            <connector implementation="org.eclipse.jetty.server.nio.SelectChannelConnector">
 | 
			
		||||
              <port>8002</port>
 | 
			
		||||
              <maxIdleTime>60000</maxIdleTime>
 | 
			
		||||
              <confidentialPort>8443</confidentialPort>
 | 
			
		||||
            </connector>
 | 
			
		||||
          </connectors>
 | 
			
		||||
        </configuration>
 | 
			
		||||
        <executions>
 | 
			
		||||
          <execution>
 | 
			
		||||
            <id>start-jetty</id>
 | 
			
		||||
            <phase>pre-integration-test</phase>
 | 
			
		||||
            <goals>
 | 
			
		||||
              <goal>run-war</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>exec-maven-plugin</artifactId>
 | 
			
		||||
        <version>1.2.1</version>
 | 
			
		||||
        <executions>
 | 
			
		||||
          <execution>
 | 
			
		||||
            <id>install-pods</id>
 | 
			
		||||
            <phase>pre-integration-test</phase>
 | 
			
		||||
            <goals>
 | 
			
		||||
              <goal>exec</goal>
 | 
			
		||||
            </goals>
 | 
			
		||||
            <configuration>
 | 
			
		||||
              <executable>pod</executable>
 | 
			
		||||
              <arguments>
 | 
			
		||||
                <argument>install</argument>
 | 
			
		||||
              </arguments>
 | 
			
		||||
            </configuration>
 | 
			
		||||
          </execution>
 | 
			
		||||
          <execution>
 | 
			
		||||
            <id>xcodebuild-test</id>
 | 
			
		||||
            <phase>integration-test</phase>
 | 
			
		||||
            <goals>
 | 
			
		||||
              <goal>exec</goal>
 | 
			
		||||
            </goals>
 | 
			
		||||
            <configuration>
 | 
			
		||||
              <executable>xcodebuild</executable>
 | 
			
		||||
              <arguments>
 | 
			
		||||
                <argument>-workspace</argument>
 | 
			
		||||
                <argument>PetstoreClient.xcworkspace</argument>
 | 
			
		||||
                <argument>-scheme</argument>
 | 
			
		||||
                <argument>PetstoreClient</argument>
 | 
			
		||||
                <argument>test</argument>
 | 
			
		||||
                <argument>-destination</argument>
 | 
			
		||||
                <argument>platform=iOS Simulator,name=iPhone 6,OS=8.2</argument>
 | 
			
		||||
              </arguments>
 | 
			
		||||
            </configuration>
 | 
			
		||||
          </execution>
 | 
			
		||||
        </executions>
 | 
			
		||||
      </plugin>
 | 
			
		||||
    </plugins>
 | 
			
		||||
  </build>
 | 
			
		||||
  <dependencies>
 | 
			
		||||
    <dependency>
 | 
			
		||||
      <groupId>com.wordnik</groupId>
 | 
			
		||||
      <artifactId>swagger-java-jersey-sample-app</artifactId>
 | 
			
		||||
      <version>${webapp-version}</version>
 | 
			
		||||
      <type>war</type>
 | 
			
		||||
      <scope>test</scope>
 | 
			
		||||
    </dependency>
 | 
			
		||||
  <repositories>
 | 
			
		||||
    <repository>
 | 
			
		||||
      <id>sonatype-snapshots</id>
 | 
			
		||||
      <url>https://oss.sonatype.org/content/repositories/snapshots</url>
 | 
			
		||||
      <snapshots>
 | 
			
		||||
        <enabled>true</enabled>
 | 
			
		||||
      </snapshots>
 | 
			
		||||
    </repository>
 | 
			
		||||
  </repositories>
 | 
			
		||||
  <properties>
 | 
			
		||||
    <webapp-version>1.5.4-M1-SNAPSHOT</webapp-version>
 | 
			
		||||
    <jetty-version>8.1.11.v20130520</jetty-version>
 | 
			
		||||
  </properties>
 | 
			
		||||
</project>
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user