Skip to content

Commit

Permalink
Rename default package in java clients (#218)
Browse files Browse the repository at this point in the history
  • Loading branch information
jmini authored Apr 24, 2018
1 parent 2c6380c commit e0b0248
Show file tree
Hide file tree
Showing 2,323 changed files with 165,366 additions and 165,354 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,31 @@

import static java.util.Collections.sort;

import org.openapitools.codegen.*;
import org.apache.commons.lang3.BooleanUtils;
import org.apache.commons.lang3.StringUtils;
import org.openapitools.codegen.CliOption;
import org.openapitools.codegen.CodegenConstants;
import org.openapitools.codegen.CodegenModel;
import org.openapitools.codegen.CodegenOperation;
import org.openapitools.codegen.CodegenParameter;
import org.openapitools.codegen.CodegenProperty;
import org.openapitools.codegen.CodegenType;
import org.openapitools.codegen.SupportingFile;
import org.openapitools.codegen.languages.features.BeanValidationFeatures;
import org.openapitools.codegen.languages.features.GzipFeatures;
import org.openapitools.codegen.languages.features.PerformBeanValidationFeatures;

import org.apache.commons.lang3.BooleanUtils;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.File;
import java.util.*;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.regex.Pattern;

public class JavaClientCodegen extends AbstractJavaCodegen
Expand Down Expand Up @@ -56,10 +69,10 @@ public JavaClientCodegen() {
super();
outputFolder = "generated-code" + File.separator + "java";
embeddedTemplateDir = templateDir = "Java";
invokerPackage = "io.swagger.client";
invokerPackage = "org.openapitools.client";
artifactId = "openapi-java-client";
apiPackage = "io.swagger.client.api";
modelPackage = "io.swagger.client.model";
apiPackage = "org.openapitools.client.api";
modelPackage = "org.openapitools.client.model";

cliOptions.add(CliOption.newBoolean(USE_RX_JAVA, "Whether to use the RxJava adapter with the retrofit2 library."));
cliOptions.add(CliOption.newBoolean(USE_RX_JAVA2, "Whether to use the RxJava2 adapter with the retrofit2 library."));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,5 @@
package org.openapitools.codegen.java;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;

import org.testng.Assert;
import org.testng.annotations.Test;

import com.google.common.collect.ImmutableMap;

import io.swagger.v3.oas.models.media.ArraySchema;
Expand All @@ -31,6 +20,16 @@
import org.openapitools.codegen.CodegenOperation;
import org.openapitools.codegen.CodegenParameter;
import org.openapitools.codegen.languages.JavaClientCodegen;
import org.testng.Assert;
import org.testng.annotations.Test;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;

public class JavaClientCodegenTest {

Expand Down Expand Up @@ -213,12 +212,12 @@ public void testInitialConfigValues() throws Exception {
Assert.assertEquals(codegen.additionalProperties().get(CodegenConstants.HIDE_GENERATION_TIMESTAMP), Boolean.FALSE);
Assert.assertEquals(codegen.isHideGenerationTimestamp(), false);

Assert.assertEquals(codegen.modelPackage(), "io.swagger.client.model");
Assert.assertEquals(codegen.additionalProperties().get(CodegenConstants.MODEL_PACKAGE), "io.swagger.client.model");
Assert.assertEquals(codegen.apiPackage(), "io.swagger.client.api");
Assert.assertEquals(codegen.additionalProperties().get(CodegenConstants.API_PACKAGE), "io.swagger.client.api");
Assert.assertEquals(codegen.getInvokerPackage(), "io.swagger.client");
Assert.assertEquals(codegen.additionalProperties().get(CodegenConstants.INVOKER_PACKAGE), "io.swagger.client");
Assert.assertEquals(codegen.modelPackage(), "org.openapitools.client.model");
Assert.assertEquals(codegen.additionalProperties().get(CodegenConstants.MODEL_PACKAGE), "org.openapitools.client.model");
Assert.assertEquals(codegen.apiPackage(), "org.openapitools.client.api");
Assert.assertEquals(codegen.additionalProperties().get(CodegenConstants.API_PACKAGE), "org.openapitools.client.api");
Assert.assertEquals(codegen.getInvokerPackage(), "org.openapitools.client");
Assert.assertEquals(codegen.additionalProperties().get(CodegenConstants.INVOKER_PACKAGE), "org.openapitools.client");
}

@Test
Expand Down Expand Up @@ -282,8 +281,8 @@ public void testPackageNamesSetInvokerDerivedFromModel() throws Exception {

Assert.assertEquals(codegen.modelPackage(), "xyz.yyyyy.zzzzzzz.mmmmm.model");
Assert.assertEquals(codegen.additionalProperties().get(CodegenConstants.MODEL_PACKAGE), "xyz.yyyyy.zzzzzzz.mmmmm.model");
Assert.assertEquals(codegen.apiPackage(), "io.swagger.client.api");
Assert.assertEquals(codegen.additionalProperties().get(CodegenConstants.API_PACKAGE), "io.swagger.client.api");
Assert.assertEquals(codegen.apiPackage(), "org.openapitools.client.api");
Assert.assertEquals(codegen.additionalProperties().get(CodegenConstants.API_PACKAGE), "org.openapitools.client.api");
Assert.assertEquals(codegen.getInvokerPackage(), "xyz.yyyyy.zzzzzzz.mmmmm");
Assert.assertEquals(codegen.additionalProperties().get(CodegenConstants.INVOKER_PACKAGE), "xyz.yyyyy.zzzzzzz.mmmmm");
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<manifest package="io.swagger.client" xmlns:android="http://schemas.android.com/apk/res/android">
<manifest package="org.openapitools.client" xmlns:android="http://schemas.android.com/apk/res/android">
<application />
</manifest>
Loading

0 comments on commit e0b0248

Please sign in to comment.