Skip to content

Commit

Permalink
Move package handling before super call
Browse files Browse the repository at this point in the history
  • Loading branch information
jmini committed Apr 3, 2018
1 parent 5cc0e21 commit 3e96e04
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -209,20 +209,6 @@ public String getHelp() {

@Override
public void processOpts() {
super.processOpts();

if (additionalProperties.containsKey(PACKAGE_PATH)) {
this.setPackagePath((String) additionalProperties.get(PACKAGE_PATH));
} else {
additionalProperties.put(PACKAGE_PATH, packagePath);
}

if (additionalProperties.containsKey(SRC_BASE_PATH)) {
this.setSrcBasePath((String) additionalProperties.get(SRC_BASE_PATH));
} else {
additionalProperties.put(SRC_BASE_PATH, srcBasePath);
}

if (additionalProperties.containsKey(CodegenConstants.INVOKER_PACKAGE)) {
this.setInvokerPackage((String) additionalProperties.get(CodegenConstants.INVOKER_PACKAGE));

Expand Down Expand Up @@ -251,6 +237,20 @@ public void processOpts() {
additionalProperties.put(COMPOSER_PROJECT_NAME, composerProjectName);
}

super.processOpts();

if (additionalProperties.containsKey(PACKAGE_PATH)) {
this.setPackagePath((String) additionalProperties.get(PACKAGE_PATH));
} else {
additionalProperties.put(PACKAGE_PATH, packagePath);
}

if (additionalProperties.containsKey(SRC_BASE_PATH)) {
this.setSrcBasePath((String) additionalProperties.get(SRC_BASE_PATH));
} else {
additionalProperties.put(SRC_BASE_PATH, srcBasePath);
}

if (additionalProperties.containsKey(CodegenConstants.GIT_USER_ID)) {
this.setGitUserId((String) additionalProperties.get(CodegenConstants.GIT_USER_ID));
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ public void testInitialValues() throws Exception {
Assert.assertEquals(codegen.invokerPackage, "Swagger\\Client");
Assert.assertEquals(codegen.additionalProperties().get(CodegenConstants.INVOKER_PACKAGE), "Swagger\\Client");
Assert.assertEquals(codegen.getSortParamsByRequiredFlag(), Boolean.TRUE);
Assert.assertEquals(codegen.additionalProperties().get(CodegenConstants.SORT_PARAMS_BY_REQUIRED_FLAG), Boolean.TRUE);
Assert.assertEquals(codegen.getHideGenerationTimestamp(), Boolean.TRUE);
Assert.assertEquals(codegen.additionalProperties().get(CodegenConstants.HIDE_GENERATION_TIMESTAMP), Boolean.TRUE);
}
Expand All @@ -39,6 +40,7 @@ public void testSetters() throws Exception {
Assert.assertEquals(codegen.invokerPackage, "My\\Client\\Invoker");
Assert.assertEquals(codegen.additionalProperties().get(CodegenConstants.INVOKER_PACKAGE), "My\\Client\\Invoker");
Assert.assertEquals(codegen.getSortParamsByRequiredFlag(), Boolean.FALSE);
Assert.assertEquals(codegen.additionalProperties().get(CodegenConstants.SORT_PARAMS_BY_REQUIRED_FLAG), Boolean.FALSE);
Assert.assertEquals(codegen.getHideGenerationTimestamp(), Boolean.FALSE);
Assert.assertEquals(codegen.additionalProperties().get(CodegenConstants.HIDE_GENERATION_TIMESTAMP), Boolean.FALSE);
}
Expand Down

0 comments on commit 3e96e04

Please sign in to comment.