Restoring the pom.xml so integration tests work

This commit is contained in:
Andrew B 2015-05-07 01:09:25 -07:00
parent 01b7385a5e
commit 20ced771ba
5 changed files with 367 additions and 76 deletions

View File

@ -51,6 +51,7 @@ public class AndroidClientCodegen extends DefaultCodegen implements CodegenConfi
additionalProperties.put("artifactId", artifactId); additionalProperties.put("artifactId", artifactId);
additionalProperties.put("artifactVersion", artifactVersion); additionalProperties.put("artifactVersion", artifactVersion);
supportingFiles.add(new SupportingFile("pom.mustache", "", "pom.xml"));
supportingFiles.add(new SupportingFile("build.mustache", "", "build.gradle")); supportingFiles.add(new SupportingFile("build.mustache", "", "build.gradle"));
supportingFiles.add(new SupportingFile("manifest.mustache", projectFolder, "AndroidManifest.xml")); supportingFiles.add(new SupportingFile("manifest.mustache", projectFolder, "AndroidManifest.xml"));
supportingFiles.add(new SupportingFile("apiInvoker.mustache", supportingFiles.add(new SupportingFile("apiInvoker.mustache",

View File

@ -33,33 +33,23 @@ public class JsonUtil {
} }
public static Type getListTypeForDeserialization(Class cls) { public static Type getListTypeForDeserialization(Class cls) {
Type type = null; String className = cls.getSimpleName();
switch (cls.getSimpleName()) { {{#models}}{{#model}}
{{#models}}{{#model}} if ("{{classname}}".equalsIgnoreCase(className)) {
case "{{classname}}": return new TypeToken<List<{{classname}}>>(){}.getType();
type = new TypeToken<List<{{classname}}>>(){}.getType();
break;
{{/model}}{{/models}}
default:
type = new TypeToken<List<Object>>(){}.getType();
break;
} }
return type; {{/model}}{{/models}}
return new TypeToken<List<Object>>(){}.getType();
} }
public static Type getTypeForDeserialization(Class cls) { public static Type getTypeForDeserialization(Class cls) {
Type type = null; String className = cls.getSimpleName();
switch (cls.getSimpleName()) { {{#models}}{{#model}}
{{#models}}{{#model}} if ("{{classname}}".equalsIgnoreCase(className)) {
case "{{classname}}": return new TypeToken<{{classname}}>(){}.getType();
type = new TypeToken<{{classname}}>(){}.getType();
break;
{{/model}}{{/models}}
default:
type = new TypeToken<Object>(){}.getType();
break;
} }
return type; {{/model}}{{/models}}
return new TypeToken<Object>(){}.getType();
} }
}; };

View File

@ -0,0 +1,155 @@
<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>{{groupId}}</groupId>
<artifactId>{{artifactId}}</artifactId>
<packaging>jar</packaging>
<name>{{artifactId}}</name>
<version>{{artifactVersion}}</version>
<scm>
<connection>scm:git:git@github.com:wordnik/swagger-mustache.git</connection>
<developerConnection>scm:git:git@github.com:wordnik/swagger-codegen.git</developerConnection>
<url>https://github.com/wordnik/swagger-codegen</url>
</scm>
<prerequisites>
<maven>2.2.0</maven>
</prerequisites>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.12</version>
<configuration>
<systemProperties>
<property>
<name>loggerPath</name>
<value>conf/log4j.properties</value>
</property>
</systemProperties>
<argLine>-Xms512m -Xmx1500m</argLine>
<parallel>methods</parallel>
<forkMode>pertest</forkMode>
</configuration>
</plugin>
<plugin>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}/lib</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
<!-- attach test jar -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.2</version>
<executions>
<execution>
<goals>
<goal>jar</goal>
<goal>test-jar</goal>
</goals>
</execution>
</executions>
<configuration>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<executions>
<execution>
<id>add_sources</id>
<phase>generate-sources</phase>
<goals>
<goal>add-source</goal>
</goals>
<configuration>
<sources>
<source>src/main/java</source>
</sources>
</configuration>
</execution>
<execution>
<id>add_test_sources</id>
<phase>generate-test-sources</phase>
<goals>
<goal>add-test-source</goal>
</goals>
<configuration>
<sources>
<source>src/test/java</source>
</sources>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>com.wordnik</groupId>
<artifactId>swagger-annotations</artifactId>
<version>${swagger-annotations-version}</version>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>${gson-version}</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>${httpclient-version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpmime</artifactId>
<version>${httpclient-version}</version>
<scope>compile</scope>
</dependency>
<!-- test dependencies -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${junit-version}</version>
<scope>test</scope>
</dependency>
</dependencies>
<repositories>
<repository>
<id>sonatype-snapshots</id>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
</repository>
</repositories>
<properties>
<swagger-annotations-version>1.5.1-M1</swagger-annotations-version>
<gson-version>2.3.1</gson-version>
<junit-version>4.8.1</junit-version>
<maven-plugin-version>1.0.0</maven-plugin-version>
<junit-version>4.8.1</junit-version>
<httpclient-version>4.3.6</httpclient-version>
</properties>
</project>

View File

@ -0,0 +1,155 @@
<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-android-client</artifactId>
<packaging>jar</packaging>
<name>swagger-android-client</name>
<version>1.0.0</version>
<scm>
<connection>scm:git:git@github.com:wordnik/swagger-mustache.git</connection>
<developerConnection>scm:git:git@github.com:wordnik/swagger-codegen.git</developerConnection>
<url>https://github.com/wordnik/swagger-codegen</url>
</scm>
<prerequisites>
<maven>2.2.0</maven>
</prerequisites>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.12</version>
<configuration>
<systemProperties>
<property>
<name>loggerPath</name>
<value>conf/log4j.properties</value>
</property>
</systemProperties>
<argLine>-Xms512m -Xmx1500m</argLine>
<parallel>methods</parallel>
<forkMode>pertest</forkMode>
</configuration>
</plugin>
<plugin>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}/lib</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
<!-- attach test jar -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.2</version>
<executions>
<execution>
<goals>
<goal>jar</goal>
<goal>test-jar</goal>
</goals>
</execution>
</executions>
<configuration>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<executions>
<execution>
<id>add_sources</id>
<phase>generate-sources</phase>
<goals>
<goal>add-source</goal>
</goals>
<configuration>
<sources>
<source>src/main/java</source>
</sources>
</configuration>
</execution>
<execution>
<id>add_test_sources</id>
<phase>generate-test-sources</phase>
<goals>
<goal>add-test-source</goal>
</goals>
<configuration>
<sources>
<source>src/test/java</source>
</sources>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>com.wordnik</groupId>
<artifactId>swagger-annotations</artifactId>
<version>${swagger-annotations-version}</version>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>${gson-version}</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>${httpclient-version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpmime</artifactId>
<version>${httpclient-version}</version>
<scope>compile</scope>
</dependency>
<!-- test dependencies -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${junit-version}</version>
<scope>test</scope>
</dependency>
</dependencies>
<repositories>
<repository>
<id>sonatype-snapshots</id>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
</repository>
</repositories>
<properties>
<swagger-annotations-version>1.5.1-M1</swagger-annotations-version>
<gson-version>2.3.1</gson-version>
<junit-version>4.8.1</junit-version>
<maven-plugin-version>1.0.0</maven-plugin-version>
<junit-version>4.8.1</junit-version>
<httpclient-version>4.3.6</httpclient-version>
</properties>
</project>

View File

@ -33,65 +33,55 @@ public class JsonUtil {
} }
public static Type getListTypeForDeserialization(Class cls) { public static Type getListTypeForDeserialization(Class cls) {
Type type = null; String className = cls.getSimpleName();
switch (cls.getSimpleName()) {
if ("User".equalsIgnoreCase(className)) {
case "User": return new TypeToken<List<User>>(){}.getType();
type = new TypeToken<List<User>>(){}.getType();
break;
case "Category":
type = new TypeToken<List<Category>>(){}.getType();
break;
case "Pet":
type = new TypeToken<List<Pet>>(){}.getType();
break;
case "Tag":
type = new TypeToken<List<Tag>>(){}.getType();
break;
case "Order":
type = new TypeToken<List<Order>>(){}.getType();
break;
default:
type = new TypeToken<List<Object>>(){}.getType();
break;
} }
return type;
if ("Category".equalsIgnoreCase(className)) {
return new TypeToken<List<Category>>(){}.getType();
}
if ("Pet".equalsIgnoreCase(className)) {
return new TypeToken<List<Pet>>(){}.getType();
}
if ("Tag".equalsIgnoreCase(className)) {
return new TypeToken<List<Tag>>(){}.getType();
}
if ("Order".equalsIgnoreCase(className)) {
return new TypeToken<List<Order>>(){}.getType();
}
return new TypeToken<List<Object>>(){}.getType();
} }
public static Type getTypeForDeserialization(Class cls) { public static Type getTypeForDeserialization(Class cls) {
Type type = null; String className = cls.getSimpleName();
switch (cls.getSimpleName()) {
if ("User".equalsIgnoreCase(className)) {
case "User": return new TypeToken<User>(){}.getType();
type = new TypeToken<User>(){}.getType();
break;
case "Category":
type = new TypeToken<Category>(){}.getType();
break;
case "Pet":
type = new TypeToken<Pet>(){}.getType();
break;
case "Tag":
type = new TypeToken<Tag>(){}.getType();
break;
case "Order":
type = new TypeToken<Order>(){}.getType();
break;
default:
type = new TypeToken<Object>(){}.getType();
break;
} }
return type;
if ("Category".equalsIgnoreCase(className)) {
return new TypeToken<Category>(){}.getType();
}
if ("Pet".equalsIgnoreCase(className)) {
return new TypeToken<Pet>(){}.getType();
}
if ("Tag".equalsIgnoreCase(className)) {
return new TypeToken<Tag>(){}.getType();
}
if ("Order".equalsIgnoreCase(className)) {
return new TypeToken<Order>(){}.getType();
}
return new TypeToken<Object>(){}.getType();
} }
}; };