Change the android-volley client codegen to an Android library

This commit is contained in:
xhh
2016-01-04 19:09:07 +08:00
parent 563cabe931
commit 0103c2f906
89 changed files with 139 additions and 468 deletions

View File

@@ -43,6 +43,8 @@ public class AndroidClientOptionsTest extends AbstractOptionsTest {
times = 1;
clientCodegen.setUseAndroidMavenGradlePlugin(Boolean.valueOf(AndroidClientOptionsProvider.ANDROID_MAVEN_GRADLE_PLUGIN_VALUE));
times = 1;
clientCodegen.setLibrary(AndroidClientOptionsProvider.LIBRARY_VALUE);
times = 1;
}};
}
}

View File

@@ -1,48 +0,0 @@
package io.swagger.codegen.androidvolley;
import io.swagger.codegen.AbstractOptionsTest;
import io.swagger.codegen.CodegenConfig;
import io.swagger.codegen.languages.AndroidVolleyClientCodegen;
import io.swagger.codegen.options.AndroidClientOptionsProvider;
import io.swagger.codegen.options.AndroidVolleyClientOptionsProvider;
import mockit.Expectations;
import mockit.Tested;
public class AndroidVolleyClientOptionsTest extends AbstractOptionsTest {
@Tested
private AndroidVolleyClientCodegen clientCodegen;
public AndroidVolleyClientOptionsTest() {
super(new AndroidVolleyClientOptionsProvider());
}
@Override
protected CodegenConfig getCodegenConfig() {
return clientCodegen;
}
@Override
protected void setExpectations() {
new Expectations(clientCodegen) {{
clientCodegen.setModelPackage(AndroidVolleyClientOptionsProvider.MODEL_PACKAGE_VALUE);
times = 1;
clientCodegen.setApiPackage(AndroidVolleyClientOptionsProvider.API_PACKAGE_VALUE);
times = 1;
clientCodegen.setSortParamsByRequiredFlag(Boolean.valueOf(AndroidVolleyClientOptionsProvider.SORT_PARAMS_VALUE));
times = 1;
clientCodegen.setInvokerPackage(AndroidVolleyClientOptionsProvider.INVOKER_PACKAGE_VALUE);
times = 1;
clientCodegen.setGroupId(AndroidVolleyClientOptionsProvider.GROUP_ID_VALUE);
times = 1;
clientCodegen.setArtifactId(AndroidVolleyClientOptionsProvider.ARTIFACT_ID_VALUE);
times = 1;
clientCodegen.setArtifactVersion(AndroidVolleyClientOptionsProvider.ARTIFACT_VERSION_VALUE);
times = 1;
clientCodegen.setSourceFolder(AndroidVolleyClientOptionsProvider.SOURCE_FOLDER_VALUE);
times = 1;
clientCodegen.setUseAndroidMavenGradlePlugin(Boolean.valueOf(AndroidVolleyClientOptionsProvider.ANDROID_MAVEN_GRADLE_PLUGIN_VALUE));
times = 1;
}};
}
}

View File

@@ -18,6 +18,7 @@ public class AndroidClientOptionsProvider implements OptionsProvider {
public static final String ARTIFACT_VERSION_VALUE = "1.0.0-SNAPSHOT";
public static final String SOURCE_FOLDER_VALUE = "src/main/java/test";
public static final String ANDROID_MAVEN_GRADLE_PLUGIN_VALUE = "true";
public static final String LIBRARY_VALUE = "volley";
@Override
public String getLanguage() {
@@ -37,6 +38,7 @@ public class AndroidClientOptionsProvider implements OptionsProvider {
.put(CodegenConstants.ARTIFACT_VERSION, ARTIFACT_VERSION_VALUE)
.put(CodegenConstants.SOURCE_FOLDER, SOURCE_FOLDER_VALUE)
.put(AndroidClientCodegen.USE_ANDROID_MAVEN_GRADLE_PLUGIN, ANDROID_MAVEN_GRADLE_PLUGIN_VALUE)
.put(CodegenConstants.LIBRARY, LIBRARY_VALUE)
.build();
}

View File

@@ -1,47 +0,0 @@
package io.swagger.codegen.options;
import io.swagger.codegen.CodegenConstants;
import io.swagger.codegen.languages.AndroidVolleyClientCodegen;
import com.google.common.collect.ImmutableMap;
import java.util.Map;
public class AndroidVolleyClientOptionsProvider implements OptionsProvider {
public static final String ARTIFACT_ID_VALUE = "swagger-java-client-test";
public static final String MODEL_PACKAGE_VALUE = "package";
public static final String API_PACKAGE_VALUE = "apiPackage";
public static final String INVOKER_PACKAGE_VALUE = "io.swagger.client.test";
public static final String SORT_PARAMS_VALUE = "false";
public static final String ENSURE_UNIQUE_PARAMS_VALUE = "true";
public static final String GROUP_ID_VALUE = "io.swagger.test";
public static final String ARTIFACT_VERSION_VALUE = "1.0.0-SNAPSHOT";
public static final String SOURCE_FOLDER_VALUE = "src/main/java/test";
public static final String ANDROID_MAVEN_GRADLE_PLUGIN_VALUE = "true";
@Override
public String getLanguage() {
return "android-volley";
}
@Override
public Map<String, String> createOptions() {
ImmutableMap.Builder<String, String> builder = new ImmutableMap.Builder<String, String>();
return builder.put(CodegenConstants.MODEL_PACKAGE, MODEL_PACKAGE_VALUE)
.put(CodegenConstants.API_PACKAGE, API_PACKAGE_VALUE)
.put(CodegenConstants.SORT_PARAMS_BY_REQUIRED_FLAG, SORT_PARAMS_VALUE)
.put(CodegenConstants.ENSURE_UNIQUE_PARAMS, ENSURE_UNIQUE_PARAMS_VALUE)
.put(CodegenConstants.INVOKER_PACKAGE, INVOKER_PACKAGE_VALUE)
.put(CodegenConstants.GROUP_ID, GROUP_ID_VALUE)
.put(CodegenConstants.ARTIFACT_ID, ARTIFACT_ID_VALUE)
.put(CodegenConstants.ARTIFACT_VERSION, ARTIFACT_VERSION_VALUE)
.put(CodegenConstants.SOURCE_FOLDER, SOURCE_FOLDER_VALUE)
.put(AndroidVolleyClientCodegen.USE_ANDROID_MAVEN_GRADLE_PLUGIN, ANDROID_MAVEN_GRADLE_PLUGIN_VALUE)
.build();
}
@Override
public boolean isServer() {
return false;
}
}