Skip to content

Commit 0d2cdf5

Browse files
authored
Merge pull request #36 from virtualansoftware/3.0.0-rest-release
2.1.0 Split REST Service Release
2 parents c8ed299 + 0a40bec commit 0d2cdf5

File tree

35 files changed

+50
-2048
lines changed

35 files changed

+50
-2048
lines changed

modules/virtualan-plugin/pom.xml

Lines changed: 13 additions & 133 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@
22
<parent>
33
<groupId>io.virtualan</groupId>
44
<artifactId>virtualan-project</artifactId>
5-
<version>2.0.4-SNAPSHOT</version>
5+
<version>2.1.1-SNAPSHOT</version>
66
<relativePath>../..</relativePath>
77
</parent>
88
<modelVersion>4.0.0</modelVersion>
99
<groupId>io.virtualan</groupId>
1010
<artifactId>virtualan-plugin</artifactId>
1111
<packaging>jar</packaging>
1212
<name>virtualan-plugin</name>
13-
<version>2.0.4-SNAPSHOT</version>
13+
<version>2.1.1-SNAPSHOT</version>
1414
<properties>
1515
<additionalparam>-Xdoclint:none</additionalparam>
1616
<java.version>1.8</java.version>
@@ -21,7 +21,7 @@
2121
<springfox.version>2.9.2</springfox.version>
2222
<cxf.version>3.2.5</cxf.version>
2323
<spring.version>5.0.3.RELEASE</spring.version>
24-
<groovy.version>2.4.7</groovy.version>
24+
<groovy.version>3.0.5</groovy.version>
2525
<testng-version>6.14.3</testng-version>
2626
</properties>
2727
<developers>
@@ -232,54 +232,24 @@
232232
</profiles>
233233

234234
<dependencies>
235-
<dependency>
236-
<groupId>ch.qos.logback</groupId>
237-
<artifactId>logback-classic</artifactId>
238-
<version>${logback.version}</version>
239-
</dependency>
240235
<dependency>
241236
<groupId>org.slf4j</groupId>
242237
<artifactId>slf4j-api</artifactId>
243238
<version>${slf4j.version}</version>
244239
</dependency>
245240

246-
<dependency>
247-
<groupId>javax.xml.ws</groupId>
248-
<artifactId>jaxws-api</artifactId>
249-
<version>2.2.11</version>
250-
</dependency>
251-
252-
<dependency>
253-
<groupId>com.sun.xml.ws</groupId>
254-
<artifactId>jaxws-rt</artifactId>
255-
<version>2.3.2</version>
256-
</dependency>
257-
<dependency>
258-
<groupId>com.sun.xml.ws</groupId>
259-
<artifactId>jaxws-ri</artifactId>
260-
<version>2.3.2</version>
261-
<type>pom</type>
262-
</dependency>
263-
264-
<dependency>
265-
<groupId>wsdl4j</groupId>
266-
<artifactId>wsdl4j</artifactId>
267-
<version>1.6.2</version>
268-
</dependency>
269-
270-
271-
<dependency>
272-
<groupId>javax.xml.soap</groupId>
273-
<artifactId>javax.xml.soap-api</artifactId>
274-
<version>1.4.0</version>
275-
</dependency>
276-
277241
<dependency>
278242
<groupId>com.fasterxml.jackson.core</groupId>
279243
<artifactId>jackson-databind</artifactId>
280244
<version>2.10.4</version>
281245
</dependency>
282246

247+
<dependency>
248+
<groupId>javax.xml.bind</groupId>
249+
<artifactId>jaxb-api</artifactId>
250+
<version>2.3.1</version>
251+
</dependency>
252+
283253
<dependency>
284254
<groupId>commons-beanutils</groupId>
285255
<artifactId>commons-beanutils</artifactId>
@@ -294,18 +264,6 @@
294264
</dependency>
295265

296266

297-
<dependency>
298-
<groupId>javax.xml.bind</groupId>
299-
<artifactId>jaxb-api</artifactId>
300-
<version>2.3.1</version>
301-
</dependency>
302-
303-
<dependency>
304-
<groupId>org.javassist</groupId>
305-
<artifactId>javassist</artifactId>
306-
<version>3.23.1-GA</version>
307-
</dependency>
308-
309267
<!-- JUnit -->
310268
<dependency>
311269
<groupId>junit</groupId>
@@ -322,40 +280,15 @@
322280

323281
<dependency>
324282
<groupId>org.codehaus.groovy</groupId>
325-
<artifactId>groovy-all</artifactId>
283+
<artifactId>groovy</artifactId>
326284
<version>${groovy.version}</version>
327285
</dependency>
328286

329-
<dependency>
330-
<groupId>org.springframework.kafka</groupId>
331-
<artifactId>spring-kafka</artifactId>
332-
<version>2.4.7.RELEASE</version>
333-
</dependency>
334-
335-
<dependency>
336-
<groupId>org.springframework.integration</groupId>
337-
<artifactId>spring-integration-kafka</artifactId>
338-
<version>3.1.3.RELEASE</version>
339-
</dependency>
340-
341-
<dependency>
342-
<groupId>org.apache.kafka</groupId>
343-
<artifactId>kafka-clients</artifactId>
344-
<version>2.5.0</version>
345-
</dependency>
346-
347-
348-
<dependency>
349-
<groupId>org.springframework.boot</groupId>
350-
<artifactId>spring-boot-starter-integration</artifactId>
351-
<version>${spring.boot.version}</version>
352-
</dependency>
353287

354288
<dependency>
355289
<groupId>org.projectlombok</groupId>
356290
<artifactId>lombok</artifactId>
357291
<version>1.18.10</version>
358-
<scope>provided</scope>
359292
</dependency>
360293

361294

@@ -373,7 +306,6 @@
373306
<scope>test</scope>
374307
</dependency>
375308

376-
377309
<dependency>
378310
<groupId>org.springframework.boot</groupId>
379311
<artifactId>spring-boot-starter-web</artifactId>
@@ -392,39 +324,18 @@
392324
<version>1.5.18</version>
393325
</dependency>
394326

395-
396327
<dependency>
397328
<groupId>org.springframework.boot</groupId>
398329
<artifactId>spring-boot-starter-batch</artifactId>
399330
<version>${spring.boot.version}</version>
400331
</dependency>
401332

402-
<dependency>
403-
<groupId>org.springframework.boot</groupId>
404-
<artifactId>spring-boot-starter-activemq</artifactId>
405-
<version>${spring.boot.version}</version>
406-
</dependency>
407-
408333
<dependency>
409334
<groupId>commons-configuration</groupId>
410335
<artifactId>commons-configuration</artifactId>
411336
<version>1.10</version>
412337
</dependency>
413338

414-
415-
<dependency>
416-
<groupId>javax.servlet</groupId>
417-
<artifactId>servlet-api</artifactId>
418-
<version>2.5</version>
419-
<scope>provided</scope>
420-
</dependency>
421-
422-
<dependency>
423-
<groupId>org.slf4j</groupId>
424-
<artifactId>slf4j-log4j12</artifactId>
425-
<version>1.7.25</version>
426-
</dependency>
427-
428339
<dependency>
429340
<groupId>org.apache.commons</groupId>
430341
<artifactId>commons-lang3</artifactId>
@@ -448,52 +359,21 @@
448359
<scope>provided</scope>
449360
</dependency>
450361

451-
452-
<dependency>
453-
<groupId>javax.ws.rs</groupId>
454-
<artifactId>javax.ws.rs-api</artifactId>
455-
<version>2.1</version>
456-
</dependency>
457-
<dependency>
458-
<groupId>org.apache.cxf</groupId>
459-
<artifactId>cxf-core</artifactId>
460-
<version>${cxf.version}</version>
461-
</dependency>
462-
<dependency>
463-
<groupId>org.apache.cxf</groupId>
464-
<artifactId>cxf-rt-frontend-jaxrs</artifactId>
465-
<version>${cxf.version}</version>
466-
</dependency>
467-
468-
<dependency>
469-
<artifactId>spring-boot-starter-web-services</artifactId>
470-
<groupId>org.springframework.boot</groupId>
471-
<version>${spring.boot.version}</version>
472-
</dependency>
473-
474-
<dependency>
475-
<artifactId>javassist</artifactId>
476-
<groupId>javassist</groupId>
477-
<version>3.12.1.GA</version>
478-
</dependency>
479-
480-
481362
<dependency>
482363
<groupId>io.springfox</groupId>
483364
<artifactId>springfox-swagger2</artifactId>
484365
<version>${springfox.version}</version>
485366
</dependency>
486-
487367
<dependency>
488368
<groupId>io.springfox</groupId>
489369
<artifactId>springfox-swagger-ui</artifactId>
490370
<version>${springfox.version}</version>
491371
</dependency>
492372

493373
<dependency>
494-
<groupId>com.google.code.gson</groupId>
495-
<artifactId>gson</artifactId>
496-
<version>2.8.4</version>
374+
<groupId>javax.ws.rs</groupId>
375+
<artifactId>javax.ws.rs-api</artifactId>
376+
<version>2.1.1</version>
497377
</dependency>
498378

499379
</dependencies>

modules/virtualan-plugin/src/main/java/io/virtualan/aop/ApiVirtualAspect.java

Lines changed: 5 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@
1515

1616
package io.virtualan.aop;
1717

18-
import io.virtualan.api.WSResource;
19-
import io.virtualan.core.model.RequestType;
2018
import io.virtualan.core.VirtualServiceInfo;
2119
import java.io.IOException;
2220
import java.lang.annotation.Annotation;
@@ -36,8 +34,6 @@
3634
import javax.ws.rs.QueryParam;
3735

3836
import javax.xml.bind.JAXBException;
39-
import javax.xml.soap.SOAPException;
40-
import org.apache.cxf.jaxrs.ext.multipart.Multipart;
4137
import org.aspectj.lang.ProceedingJoinPoint;
4238
import org.aspectj.lang.annotation.Around;
4339
import org.aspectj.lang.annotation.Aspect;
@@ -59,7 +55,6 @@
5955
import io.virtualan.core.VirtualServiceUtil;
6056
import io.virtualan.core.model.MockServiceRequest;
6157
import io.virtualan.custom.message.ResponseException;
62-
import org.springframework.ws.server.endpoint.annotation.RequestPayload;
6358

6459

6560
/**
@@ -97,7 +92,7 @@ public void apiVirtualServicePointcut() {
9792

9893
@Around("apiVirtualServicePointcut()")
9994
public Object aroundAddAdvice(ProceedingJoinPoint thisJoinPoint)
100-
throws ResponseException, IOException, SOAPException, JAXBException {
95+
throws ResponseException, IOException, JAXBException {
10196
MockServiceRequest mockServiceRequest = new MockServiceRequest();
10297

10398
Object[] args = thisJoinPoint.getArgs();
@@ -109,15 +104,7 @@ public Object aroundAddAdvice(ProceedingJoinPoint thisJoinPoint)
109104

110105
SimpleEntry<Boolean, Class> isVirtualan = isVirtualService(targetClass);
111106
if (isVirtualan.getKey()) {
112-
String parentPath = null;
113-
if (WSResource.isExists(method)){
114-
SimpleEntry<String, String> path = WSResource.getResourceParent(method);
115-
mockServiceRequest.setResource(path.getValue());
116-
mockServiceRequest.setOperationId(method.getName());
117-
mockServiceRequest.setRequestType(RequestType.SOAP);
118-
readWSInputParam(args, methodSignature, mockServiceRequest);
119-
}else {
120-
parentPath = ApiResource.getResourceParent(isVirtualan.getValue());
107+
String parentPath = ApiResource.getResourceParent(isVirtualan.getValue());
121108
if(mockServiceRequest.getResource() == null) {
122109
mockServiceRequest.setResource(ApiResource.getResource(method));
123110
} else {
@@ -129,7 +116,6 @@ public Object aroundAddAdvice(ProceedingJoinPoint thisJoinPoint)
129116
Map<String, String> headersInfo = getHeadersInfo();
130117
mockServiceRequest.setHeaderParams(headersInfo);
131118
}
132-
}
133119
return getVirtualServiceUtil().returnResponse(method, mockServiceRequest);
134120
}
135121

@@ -158,34 +144,6 @@ private Map<String, String> getHeadersInfo() {
158144
return map;
159145
}
160146

161-
162-
private void readWSInputParam(Object[] args, MethodSignature methodSignature,
163-
MockServiceRequest mockServiceRequest) {
164-
Method method = methodSignature.getMethod();
165-
Annotation[][] parameterAnnotations = method.getParameterAnnotations();
166-
assert args.length == parameterAnnotations.length;
167-
for (int argIndex = 0; argIndex < args.length; argIndex++) {
168-
if (parameterAnnotations[argIndex] != null
169-
&& parameterAnnotations[argIndex].length > 0) {
170-
String requestParamName = null;
171-
for (Annotation annotation : parameterAnnotations[argIndex]) {
172-
if (annotation instanceof RequestPayload) {
173-
try {
174-
mockServiceRequest.setInputObjectType(Class.forName(
175-
(methodSignature.getParameterTypes()[argIndex]).getName()));
176-
mockServiceRequest.setInput(args[argIndex]);
177-
} catch (ClassNotFoundException e) {
178-
log.error(e.getMessage());
179-
}
180-
mockServiceRequest.setInput(args[argIndex]);
181-
}
182-
}
183-
}
184-
}
185-
186-
}
187-
188-
189147
// TODO - Code Array List
190148
private void readInputParam(Object[] args, MethodSignature methodSignature,
191149
MockServiceRequest mockServiceRequest) {
@@ -236,9 +194,9 @@ private void readInputParam(Object[] args, MethodSignature methodSignature,
236194
} else if (annotation instanceof CookieParam) {
237195
CookieParam requestParam = (CookieParam) annotation;
238196
requestParamName = requestParam.value();
239-
} else if (annotation instanceof Multipart) {
240-
Multipart requestParam = (Multipart) annotation;
241-
requestParamName = requestParam.value();
197+
// } else if (annotation instanceof Multipart) {
198+
// Multipart requestParam = (Multipart) annotation;
199+
// requestParamName = requestParam.value();
242200
} else if (requestParamName == null && VirtualServiceType.CXF_JAX_RS
243201
.equals(getVirtualServiceUtil().getVirtualServiceType())) {
244202
try {

modules/virtualan-plugin/src/main/java/io/virtualan/api/ApiResource.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
import java.lang.reflect.Method;
1919

2020
import javax.ws.rs.Path;
21-
2221
import org.springframework.web.bind.annotation.RequestMapping;
2322

2423
import io.virtualan.core.model.VirtualServiceKeyValue;

modules/virtualan-plugin/src/main/java/io/virtualan/api/WSResource.java

Lines changed: 0 additions & 29 deletions
This file was deleted.

0 commit comments

Comments
 (0)