[java] JAX-RS jersey3

This commit is contained in:
sullis
2022-03-05 20:41:40 -08:00
parent 8f70d49ff3
commit 99bfefab8c
2 changed files with 7 additions and 1 deletions

View File

@@ -30,6 +30,7 @@ public class JavaJerseyServerCodegen extends AbstractJavaJAXRSServerCodegen {
protected static final String LIBRARY_JERSEY1 = "jersey1";
protected static final String LIBRARY_JERSEY2 = "jersey2";
protected static final String LIBRARY_JERSEY3 = "jersey3";
/**
* Default library template to use. (Default: jersey2)
@@ -59,6 +60,7 @@ public class JavaJerseyServerCodegen extends AbstractJavaJAXRSServerCodegen {
CliOption library = new CliOption(CodegenConstants.LIBRARY, CodegenConstants.LIBRARY_DESC).defaultValue(DEFAULT_JERSEY_LIBRARY);
supportedLibraries.put(LIBRARY_JERSEY1, "Jersey core 1.x");
supportedLibraries.put(LIBRARY_JERSEY2, "Jersey core 2.x");
supportedLibraries.put(LIBRARY_JERSEY3, "Jersey core 3.x");
library.setEnum(supportedLibraries);
cliOptions.add(library);

View File

@@ -3,6 +3,7 @@ package org.openapitools.codegen.java.jaxrs;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSet;
import io.swagger.parser.OpenAPIParser;
import io.swagger.v3.oas.models.OpenAPI;
import io.swagger.v3.oas.models.servers.Server;
@@ -31,6 +32,7 @@ import java.nio.file.Files;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.function.Function;
import java.util.stream.Collectors;
@@ -47,6 +49,7 @@ public class JavaJerseyServerCodegenTest extends JavaJaxrsBaseTest {
Assert.assertEquals(codegen.getName(), "jaxrs-jersey");
Assert.assertEquals(codegen.getTemplatingEngine().getClass(), MustacheEngineAdapter.class);
Assert.assertEquals(codegen.getDateLibrary(), "legacy");
Assert.assertEquals(codegen.supportedLibraries().keySet(), ImmutableSet.of("jersey1", "jersey2", "jersey3"));
Assert.assertNull(codegen.getInputSpec());
codegen.processOpts();
@@ -136,8 +139,9 @@ public class JavaJerseyServerCodegenTest extends JavaJaxrsBaseTest {
@DataProvider(name = "codegenParameterMatrix")
public Object[][] codegenParameterMatrix() {
final Set<String> libraries = new JavaJerseyServerCodegen().supportedLibraries().keySet();
final List<Object[]> rows = new ArrayList<Object[]>();
for (final String jerseyLibrary: ImmutableList.of("jersey1", "jersey2")) {
for (final String jerseyLibrary: libraries) {
for (final String dateLibrary: ImmutableList.of("joda", "java8")) {
rows.add(new Object[] { jerseyLibrary, dateLibrary });
}