Merge branch 'SpringBootServer' of https://github.com/diyfr/swagger-codegen into diyfr-SpringBootServer

This commit is contained in:
wing328
2016-05-05 15:28:10 +08:00
78 changed files with 2295 additions and 34 deletions

View File

@@ -0,0 +1,32 @@
package io.swagger.codegen.options;
import io.swagger.codegen.CodegenConstants;
import io.swagger.codegen.languages.SpringBootServerCodegen;
import java.util.HashMap;
import java.util.Map;
public class SpringBootServerOptionsProvider extends JavaOptionsProvider {
public static final String CONFIG_PACKAGE_VALUE = "configPackage";
public static final String BASE_PACKAGE_VALUE = "basePackage";
public static final String LIBRARY_VALUE = "j8-async"; //FIXME hidding value from super class
@Override
public String getLanguage() {
return "springboot";
}
@Override
public Map<String, String> createOptions() {
Map<String, String> options = new HashMap<String, String>(super.createOptions());
options.put(SpringBootServerCodegen.CONFIG_PACKAGE, CONFIG_PACKAGE_VALUE);
options.put(SpringBootServerCodegen.BASE_PACKAGE, BASE_PACKAGE_VALUE);
options.put(CodegenConstants.LIBRARY, LIBRARY_VALUE);
return options;
}
@Override
public boolean isServer() {
return true;
}
}

View File

@@ -0,0 +1,60 @@
package io.swagger.codegen.springBoot;
import io.swagger.codegen.CodegenConfig;
import io.swagger.codegen.java.JavaClientOptionsTest;
import io.swagger.codegen.languages.SpringBootServerCodegen;
import io.swagger.codegen.options.SpringBootServerOptionsProvider;
import mockit.Expectations;
import mockit.Tested;
public class SpringBootServerOptionsTest extends JavaClientOptionsTest {
@Tested
private SpringBootServerCodegen clientCodegen;
public SpringBootServerOptionsTest() {
super(new SpringBootServerOptionsProvider());
}
@Override
protected CodegenConfig getCodegenConfig() {
return clientCodegen;
}
@SuppressWarnings("unused")
@Override
protected void setExpectations() {
new Expectations(clientCodegen) {{
clientCodegen.setModelPackage(SpringBootServerOptionsProvider.MODEL_PACKAGE_VALUE);
times = 1;
clientCodegen.setApiPackage(SpringBootServerOptionsProvider.API_PACKAGE_VALUE);
times = 1;
clientCodegen.setSortParamsByRequiredFlag(Boolean.valueOf(SpringBootServerOptionsProvider.SORT_PARAMS_VALUE));
times = 1;
clientCodegen.setInvokerPackage(SpringBootServerOptionsProvider.INVOKER_PACKAGE_VALUE);
times = 1;
clientCodegen.setGroupId(SpringBootServerOptionsProvider.GROUP_ID_VALUE);
times = 1;
clientCodegen.setArtifactId(SpringBootServerOptionsProvider.ARTIFACT_ID_VALUE);
times = 1;
clientCodegen.setArtifactVersion(SpringBootServerOptionsProvider.ARTIFACT_VERSION_VALUE);
times = 1;
clientCodegen.setSourceFolder(SpringBootServerOptionsProvider.SOURCE_FOLDER_VALUE);
times = 1;
clientCodegen.setLocalVariablePrefix(SpringBootServerOptionsProvider.LOCAL_PREFIX_VALUE);
times = 1;
clientCodegen.setSerializableModel(Boolean.valueOf(SpringBootServerOptionsProvider.SERIALIZABLE_MODEL_VALUE));
times = 1;
clientCodegen.setLibrary(SpringBootServerOptionsProvider.LIBRARY_VALUE);
times = 1;
clientCodegen.setFullJavaUtil(Boolean.valueOf(SpringBootServerOptionsProvider.FULL_JAVA_UTIL_VALUE));
times = 1;
clientCodegen.setConfigPackage(SpringBootServerOptionsProvider.CONFIG_PACKAGE_VALUE);
times = 1;
clientCodegen.setBasePackage(SpringBootServerOptionsProvider.BASE_PACKAGE_VALUE);
times = 1;
}};
}
}