Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
jfiala committed Oct 15, 2016
1 parent 8d8c66f commit cbf7c62
Show file tree
Hide file tree
Showing 3 changed files with 85 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,18 @@ public class JavaCXFServerCodegen extends AbstractJavaJAXRSServerCodegen

protected boolean generateSpringApplication = false;

protected boolean useSwaggerFeature = false;

protected boolean useWadlFeature = false;

protected boolean useMultipartFeature = false;

protected boolean useGzipFeature = false;

protected boolean useLoggingFeature = false;

protected boolean useBeanValidationFeature = false;


public JavaCXFServerCodegen()
{
Expand Down Expand Up @@ -101,15 +113,16 @@ public void processOpts()
}

if (additionalProperties.containsKey(GENERATE_SPRING_APPLICATION)) {
boolean generateSpringApplicationProp = convertPropertyToBooleanAndWriteBack(GENERATE_SPRING_APPLICATION);
this.setGenerateSpringApplication(generateSpringApplicationProp);
this.setGenerateSpringApplication(convertPropertyToBooleanAndWriteBack(GENERATE_SPRING_APPLICATION));

this.setUseSwaggerFeature(convertPropertyToBooleanAndWriteBack(USE_SWAGGER_FEATURE));
this.setUseWadlFeature(convertPropertyToBooleanAndWriteBack(USE_WADL_FEATURE));
this.setUseMultipartFeature(convertPropertyToBooleanAndWriteBack(USE_MULTIPART_FEATURE));
this.setUseGzipFeature(convertPropertyToBooleanAndWriteBack(USE_GZIP_FEATURE));
this.setUseLoggingFeature(convertPropertyToBooleanAndWriteBack(USE_LOGGING_FEATURE));

convertPropertyToBooleanAndWriteBack(USE_SWAGGER_FEATURE);
convertPropertyToBooleanAndWriteBack(USE_WADL_FEATURE);
convertPropertyToBooleanAndWriteBack(USE_MULTIPART_FEATURE);
convertPropertyToBooleanAndWriteBack(USE_GZIP_FEATURE);
convertPropertyToBooleanAndWriteBack(USE_LOGGING_FEATURE);
boolean useBeanValidationFeature = convertPropertyToBooleanAndWriteBack(USE_BEANVALIDATION_FEATURE);
this.setUseBeanValidationFeature(useBeanValidationFeature);
if (useBeanValidationFeature) {
LOGGER.info("make sure your target server supports Bean Validation 1.1");
}
Expand Down Expand Up @@ -180,4 +193,36 @@ public void setUseBeanValidation(boolean useBeanValidation) {
public void setGenerateSpringApplication(boolean generateSpringApplication) {
this.generateSpringApplication = generateSpringApplication;
}


public void setUseSwaggerFeature(boolean useSwaggerFeature) {
this.useSwaggerFeature = useSwaggerFeature;
}


public void setUseWadlFeature(boolean useWadlFeature) {
this.useWadlFeature = useWadlFeature;
}


public void setUseMultipartFeature(boolean useMultipartFeature) {
this.useMultipartFeature = useMultipartFeature;
}


public void setUseGzipFeature(boolean useGzipFeature) {
this.useGzipFeature = useGzipFeature;
}


public void setUseLoggingFeature(boolean useLoggingFeature) {
this.useLoggingFeature = useLoggingFeature;
}


public void setUseBeanValidationFeature(boolean useBeanValidationFeature) {
this.useBeanValidationFeature = useBeanValidationFeature;
}


}
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,19 @@ protected void setExpectations() {

clientCodegen.setUseBeanValidation(Boolean.valueOf(JavaCXFServerOptionsProvider.USE_BEANVALIDATION));
times = 1;
clientCodegen.setGenerateSpringApplication(Boolean.valueOf(JavaCXFServerOptionsProvider.GENERATE_SPRING_APPLICATION));
clientCodegen.setGenerateSpringApplication(Boolean.valueOf(JavaCXFServerOptionsProvider.USE_SWAGGER_FEATURE));
times = 1;
clientCodegen.setGenerateSpringApplication(Boolean.valueOf(JavaCXFServerOptionsProvider.USE_WADL_FEATURE));
times = 1;
clientCodegen.setGenerateSpringApplication(Boolean.valueOf(JavaCXFServerOptionsProvider.USE_MULTIPART_FEATURE));
times = 1;
clientCodegen.setGenerateSpringApplication(Boolean.valueOf(JavaCXFServerOptionsProvider.USE_GZIP_FEATURE));
times = 1;
clientCodegen.setGenerateSpringApplication(Boolean.valueOf(JavaCXFServerOptionsProvider.USE_LOGGING_FEATURE));
times = 1;
clientCodegen.setGenerateSpringApplication(Boolean.valueOf(JavaCXFServerOptionsProvider.USE_BEANVALIDATION_FEATURE));
times = 1;



}};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,19 @@

public class JavaCXFServerOptionsProvider extends JavaOptionsProvider {

public static final String GENERATE_SPRING_APPLICATION = "false";
public static final String GENERATE_SPRING_APPLICATION = "true";

public static final String USE_SWAGGER_FEATURE = "true";

public static final String USE_WADL_FEATURE = "true";

public static final String USE_MULTIPART_FEATURE = "true";

public static final String USE_GZIP_FEATURE = "true";

public static final String USE_LOGGING_FEATURE = "true";

public static final String USE_BEANVALIDATION_FEATURE = "true";

public static final String IMPL_FOLDER_VALUE = "src/main/java";

Expand All @@ -34,8 +46,14 @@ public Map<String, String> createOptions() {
builder.put(CodegenConstants.IMPL_FOLDER, IMPL_FOLDER_VALUE);
builder.put("title", "Test title");

builder.put(JavaCXFServerCodegen.USE_BEANVALIDATION, "false");
builder.put(JavaCXFServerCodegen.GENERATE_SPRING_APPLICATION, "false");
builder.put(JavaCXFServerCodegen.USE_BEANVALIDATION, JavaOptionsProvider.USE_BEANVALIDATION);
builder.put(JavaCXFServerCodegen.GENERATE_SPRING_APPLICATION, GENERATE_SPRING_APPLICATION);
builder.put(JavaCXFServerCodegen.USE_SWAGGER_FEATURE, USE_SWAGGER_FEATURE);
builder.put(JavaCXFServerCodegen.USE_WADL_FEATURE, USE_WADL_FEATURE);
builder.put(JavaCXFServerCodegen.USE_MULTIPART_FEATURE, USE_MULTIPART_FEATURE);
builder.put(JavaCXFServerCodegen.USE_GZIP_FEATURE, USE_GZIP_FEATURE);
builder.put(JavaCXFServerCodegen.USE_LOGGING_FEATURE, USE_LOGGING_FEATURE);
builder.put(JavaCXFServerCodegen.USE_BEANVALIDATION_FEATURE, USE_BEANVALIDATION_FEATURE);

return builder.build();

Expand Down

0 comments on commit cbf7c62

Please sign in to comment.