forked from swagger-api/swagger-codegen
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add tests for jaxrs-resteasy-eap swagger-api#4512
- Loading branch information
Showing
2 changed files
with
125 additions
and
0 deletions.
There are no files selected for viewing
75 changes: 75 additions & 0 deletions
75
...gger-codegen/src/test/java/io/swagger/codegen/jaxrs/JavaResteasyEapServerOptionsTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
package io.swagger.codegen.jaxrs; | ||
|
||
import io.swagger.codegen.AbstractOptionsTest; | ||
import io.swagger.codegen.CodegenConfig; | ||
import io.swagger.codegen.languages.JavaResteasyEapServerCodegen; | ||
import io.swagger.codegen.options.JavaResteasyEapServerOptionsProvider; | ||
import io.swagger.codegen.options.OptionsProvider; | ||
import mockit.Expectations; | ||
import mockit.Tested; | ||
|
||
public class JavaResteasyEapServerOptionsTest extends AbstractOptionsTest { | ||
|
||
@Tested | ||
private JavaResteasyEapServerCodegen clientCodegen; | ||
|
||
public JavaResteasyEapServerOptionsTest() { | ||
super(new JavaResteasyEapServerOptionsProvider()); | ||
} | ||
|
||
protected JavaResteasyEapServerOptionsTest(OptionsProvider optionsProvider) { | ||
super(optionsProvider); | ||
} | ||
|
||
@Override | ||
protected CodegenConfig getCodegenConfig() { | ||
return clientCodegen; | ||
} | ||
|
||
@Override | ||
protected void setExpectations() { | ||
new Expectations(clientCodegen) { | ||
{ | ||
clientCodegen.setModelPackage(JavaResteasyEapServerOptionsProvider.MODEL_PACKAGE_VALUE); | ||
times = 1; | ||
clientCodegen.setApiPackage(JavaResteasyEapServerOptionsProvider.API_PACKAGE_VALUE); | ||
times = 1; | ||
clientCodegen.setSortParamsByRequiredFlag( | ||
Boolean.valueOf(JavaResteasyEapServerOptionsProvider.SORT_PARAMS_VALUE)); | ||
times = 1; | ||
clientCodegen.setInvokerPackage(JavaResteasyEapServerOptionsProvider.INVOKER_PACKAGE_VALUE); | ||
times = 1; | ||
clientCodegen.setGroupId(JavaResteasyEapServerOptionsProvider.GROUP_ID_VALUE); | ||
times = 1; | ||
clientCodegen.setArtifactId(JavaResteasyEapServerOptionsProvider.ARTIFACT_ID_VALUE); | ||
times = 1; | ||
clientCodegen.setArtifactVersion(JavaResteasyEapServerOptionsProvider.ARTIFACT_VERSION_VALUE); | ||
times = 1; | ||
clientCodegen.setSourceFolder(JavaResteasyEapServerOptionsProvider.SOURCE_FOLDER_VALUE); | ||
times = 1; | ||
clientCodegen.setLocalVariablePrefix(JavaResteasyEapServerOptionsProvider.LOCAL_PREFIX_VALUE); | ||
times = 1; | ||
clientCodegen.setSerializableModel( | ||
Boolean.valueOf(JavaResteasyEapServerOptionsProvider.SERIALIZABLE_MODEL_VALUE)); | ||
times = 1; | ||
clientCodegen | ||
.setFullJavaUtil(Boolean.valueOf(JavaResteasyEapServerOptionsProvider.FULL_JAVA_UTIL_VALUE)); | ||
times = 1; | ||
clientCodegen.setSerializeBigDecimalAsString(true); | ||
times = 1; | ||
|
||
clientCodegen.setGenerateJbossDeploymentDescriptor( | ||
Boolean.valueOf(JavaResteasyEapServerOptionsProvider.GENERATE_JBOSS_DEPLOYMENT_DESCRIPTOR)); | ||
|
||
clientCodegen | ||
.setUseBeanValidation(Boolean.valueOf(JavaResteasyEapServerOptionsProvider.USE_BEANVALIDATION)); | ||
times = 1; | ||
clientCodegen | ||
.setUseBeanValidation( | ||
Boolean.valueOf(JavaResteasyEapServerOptionsProvider.USE_SWAGGER_FEATURE)); | ||
times = 1; | ||
|
||
} | ||
}; | ||
} | ||
} |
50 changes: 50 additions & 0 deletions
50
...odegen/src/test/java/io/swagger/codegen/options/JavaResteasyEapServerOptionsProvider.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
package io.swagger.codegen.options; | ||
|
||
import java.util.Map; | ||
|
||
import com.google.common.collect.ImmutableMap; | ||
|
||
import io.swagger.codegen.CodegenConstants; | ||
import io.swagger.codegen.languages.JavaCXFServerCodegen; | ||
import io.swagger.codegen.languages.JavaResteasyEapServerCodegen; | ||
import io.swagger.codegen.languages.JavaResteasyServerCodegen; | ||
|
||
public class JavaResteasyEapServerOptionsProvider extends JavaOptionsProvider { | ||
|
||
public static final String GENERATE_JBOSS_DEPLOYMENT_DESCRIPTOR = "true"; | ||
|
||
public static final String IMPL_FOLDER_VALUE = "src/main/java"; | ||
|
||
public static final String USE_BEANVALIDATION = "true"; | ||
|
||
public static final String USE_SWAGGER_FEATURE = "true"; | ||
|
||
@Override | ||
public boolean isServer() { | ||
return true; | ||
} | ||
|
||
@Override | ||
public String getLanguage() { | ||
return "jaxrs-resteasy-eap"; | ||
} | ||
|
||
@Override | ||
public Map<String, String> createOptions() { | ||
|
||
Map<String, String> parentOptions = super.createOptions(); | ||
|
||
ImmutableMap.Builder<String, String> builder = new ImmutableMap.Builder<String, String>() | ||
.putAll(parentOptions); | ||
|
||
builder.put(CodegenConstants.IMPL_FOLDER, IMPL_FOLDER_VALUE); | ||
builder.put("title", "Test title"); | ||
|
||
builder.put(JavaCXFServerCodegen.GENERATE_JBOSS_DEPLOYMENT_DESCRIPTOR, GENERATE_JBOSS_DEPLOYMENT_DESCRIPTOR); | ||
builder.put(JavaResteasyServerCodegen.USE_BEANVALIDATION, USE_BEANVALIDATION); | ||
builder.put(JavaResteasyEapServerCodegen.USE_SWAGGER_FEATURE, USE_SWAGGER_FEATURE); | ||
|
||
return builder.build(); | ||
|
||
} | ||
} |