Skip to content

Commit

Permalink
add tests for jaxrs-resteasy-eap swagger-api#4512
Browse files Browse the repository at this point in the history
  • Loading branch information
jfiala committed Feb 4, 2017
1 parent 17ec0ac commit 084fffe
Show file tree
Hide file tree
Showing 2 changed files with 125 additions and 0 deletions.
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;

}
};
}
}
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();

}
}

0 comments on commit 084fffe

Please sign in to comment.