|
12 | 12 | import org.testng.annotations.Test;
|
13 | 13 |
|
14 | 14 | import java.io.File;
|
| 15 | +import java.io.IOException; |
15 | 16 | import java.io.InputStream;
|
16 | 17 | import java.util.List;
|
17 | 18 |
|
18 | 19 | public class GeneratorServiceTest {
|
19 | 20 |
|
| 21 | + @Test(description = "test generator service with jaxrs-cxf-client") |
| 22 | + public void testGeneratorService_Jaxrs_cxf_client() throws IOException { |
| 23 | + |
| 24 | + String path = getTmpFolder().getAbsolutePath(); |
| 25 | + GenerationRequest request = new GenerationRequest(); |
| 26 | + request |
| 27 | + .codegenVersion(GenerationRequest.CodegenVersion.V3) |
| 28 | + .type(GenerationRequest.Type.CLIENT) |
| 29 | + .lang("jaxrs-cxf-client") |
| 30 | + .spec(loadSpecAsNode("3_0_0/issue-9203.yaml", true, false)) |
| 31 | + .options( |
| 32 | + new Options() |
| 33 | + .outputDir(path) |
| 34 | + ); |
| 35 | + |
| 36 | + List<File> files = new GeneratorService().generationRequest(request).generate(); |
| 37 | + Assert.assertFalse(files.isEmpty()); |
| 38 | + for (File f: files) { |
| 39 | + String relPath = f.getAbsolutePath().substring(path.length()); |
| 40 | + if ("/src/gen/java/io/swagger/model/OrderLineAudit.java".equals(relPath)) { |
| 41 | + Assert.assertFalse(FileUtils.readFileToString(f).contains("isisProcessed")); |
| 42 | + } |
| 43 | + } |
| 44 | + |
| 45 | + } |
| 46 | + |
| 47 | + @Test(description = "test generator service with jaxrs-cxf-cdi") |
| 48 | + public void testGeneratorService_Jaxrs_cxf_cdi() throws IOException { |
| 49 | + |
| 50 | + String path = getTmpFolder().getAbsolutePath(); |
| 51 | + GenerationRequest request = new GenerationRequest(); |
| 52 | + request |
| 53 | + .codegenVersion(GenerationRequest.CodegenVersion.V3) |
| 54 | + .type(GenerationRequest.Type.CLIENT) |
| 55 | + .lang("jaxrs-cxf-cdi") |
| 56 | + .spec(loadSpecAsNode("3_0_0/issue-9203.yaml", true, false)) |
| 57 | + .options( |
| 58 | + new Options() |
| 59 | + .outputDir(path) |
| 60 | + ); |
| 61 | + |
| 62 | + List<File> files = new GeneratorService().generationRequest(request).generate(); |
| 63 | + Assert.assertFalse(files.isEmpty()); |
| 64 | + for (File f: files) { |
| 65 | + String relPath = f.getAbsolutePath().substring(path.length()); |
| 66 | + if ("/src/gen/java/io/swagger/model/OrderLineAudit.java".equals(relPath)) { |
| 67 | + Assert.assertFalse(FileUtils.readFileToString(f).contains("isisProcessed")); |
| 68 | + } |
| 69 | + } |
| 70 | + |
| 71 | + } |
| 72 | + |
| 73 | + @Test(description = "test generator service with jaxrs-cxf-cdi") |
| 74 | + public void testGeneratorService_Jaxrs_resteasy_eap() throws IOException { |
| 75 | + |
| 76 | + String path = getTmpFolder().getAbsolutePath(); |
| 77 | + GenerationRequest request = new GenerationRequest(); |
| 78 | + request |
| 79 | + .codegenVersion(GenerationRequest.CodegenVersion.V3) |
| 80 | + .type(GenerationRequest.Type.CLIENT) |
| 81 | + .lang("jaxrs-resteasy-eap") |
| 82 | + .spec(loadSpecAsNode("3_0_0/issue-9203.yaml", true, false)) |
| 83 | + .options( |
| 84 | + new Options() |
| 85 | + .outputDir(path) |
| 86 | + ); |
| 87 | + |
| 88 | + List<File> files = new GeneratorService().generationRequest(request).generate(); |
| 89 | + Assert.assertFalse(files.isEmpty()); |
| 90 | + for (File f: files) { |
| 91 | + String relPath = f.getAbsolutePath().substring(path.length()); |
| 92 | + if ("/src/gen/java/io/swagger/model/OrderLineAudit.java".equals(relPath)) { |
| 93 | + Assert.assertFalse(FileUtils.readFileToString(f).contains("isisProcessed")); |
| 94 | + } |
| 95 | + } |
| 96 | + } |
| 97 | + |
| 98 | + @Test(description = "test generator service with jaxrs-cxf-cdi") |
| 99 | + public void testGeneratorService_Jaxrs_resteasy() throws IOException { |
| 100 | + |
| 101 | + String path = getTmpFolder().getAbsolutePath(); |
| 102 | + GenerationRequest request = new GenerationRequest(); |
| 103 | + request |
| 104 | + .codegenVersion(GenerationRequest.CodegenVersion.V3) |
| 105 | + .type(GenerationRequest.Type.CLIENT) |
| 106 | + .lang("jaxrs-resteasy") |
| 107 | + .spec(loadSpecAsNode("3_0_0/issue-9203.yaml", true, false)) |
| 108 | + .options( |
| 109 | + new Options() |
| 110 | + .outputDir(path) |
| 111 | + ); |
| 112 | + |
| 113 | + List<File> files = new GeneratorService().generationRequest(request).generate(); |
| 114 | + Assert.assertFalse(files.isEmpty()); |
| 115 | + for (File f: files) { |
| 116 | + String relPath = f.getAbsolutePath().substring(path.length()); |
| 117 | + if ("/src/gen/java/io/swagger/model/OrderLineAudit.java".equals(relPath)) { |
| 118 | + Assert.assertFalse(FileUtils.readFileToString(f).contains("isisProcessed")); |
| 119 | + } |
| 120 | + } |
| 121 | + } |
| 122 | + |
| 123 | + @Test(description = "test generator service with jaxrs-cxf-cdi") |
| 124 | + public void testGeneratorService_Jaxrs_spec() throws IOException { |
| 125 | + |
| 126 | + String path = getTmpFolder().getAbsolutePath(); |
| 127 | + GenerationRequest request = new GenerationRequest(); |
| 128 | + request |
| 129 | + .codegenVersion(GenerationRequest.CodegenVersion.V3) |
| 130 | + .type(GenerationRequest.Type.CLIENT) |
| 131 | + .lang("jaxrs-spec") |
| 132 | + .spec(loadSpecAsNode("3_0_0/issue-9203.yaml", true, false)) |
| 133 | + .options( |
| 134 | + new Options() |
| 135 | + .outputDir(path) |
| 136 | + ); |
| 137 | + |
| 138 | + List<File> files = new GeneratorService().generationRequest(request).generate(); |
| 139 | + Assert.assertFalse(files.isEmpty()); |
| 140 | + for (File f: files) { |
| 141 | + String relPath = f.getAbsolutePath().substring(path.length()); |
| 142 | + if ("/src/gen/java/io/swagger/model/OrderLineAudit.java".equals(relPath)) { |
| 143 | + Assert.assertFalse(FileUtils.readFileToString(f).contains("isisProcessed")); |
| 144 | + } |
| 145 | + } |
| 146 | + } |
| 147 | + |
| 148 | + @Test(description = "test generator service with jaxrs-cxf-cdi") |
| 149 | + public void testGeneratorService_JavaSpring() throws IOException { |
| 150 | + |
| 151 | + String path = getTmpFolder().getAbsolutePath(); |
| 152 | + GenerationRequest request = new GenerationRequest(); |
| 153 | + request |
| 154 | + .codegenVersion(GenerationRequest.CodegenVersion.V3) |
| 155 | + .type(GenerationRequest.Type.CLIENT) |
| 156 | + .lang("spring") |
| 157 | + .spec(loadSpecAsNode("3_0_0/issue-9203.yaml", true, false)) |
| 158 | + .options( |
| 159 | + new Options() |
| 160 | + .outputDir(path) |
| 161 | + ); |
| 162 | + |
| 163 | + List<File> files = new GeneratorService().generationRequest(request).generate(); |
| 164 | + Assert.assertFalse(files.isEmpty()); |
| 165 | + for (File f: files) { |
| 166 | + String relPath = f.getAbsolutePath().substring(path.length()); |
| 167 | + if ("/src/gen/java/io/swagger/model/OrderLineAudit.java".equals(relPath)) { |
| 168 | + Assert.assertFalse(FileUtils.readFileToString(f).contains("isisProcessed")); |
| 169 | + } |
| 170 | + } |
| 171 | + } |
| 172 | + |
20 | 173 | @Test(description = "test generator service with java 3.0")
|
21 | 174 | public void testGeneratorServiceJava3() {
|
22 | 175 |
|
|
0 commit comments