Test JAX-WS endpoints

This commit is contained in:
Owen Mansel-Chan
2021-03-24 16:32:51 +00:00
parent d9cf1aaf39
commit 2cb76fe407
4 changed files with 72 additions and 0 deletions

View File

@@ -0,0 +1,44 @@
import javax.jws.WebMethod;
import javax.jws.WebService;
import javax.xml.ws.WebEndpoint;
import javax.xml.ws.WebServiceClient;
import javax.xml.ws.WebServiceProvider;
@WebService
class WebServiceClass { // $JaxWsEndpoint
@WebMethod
void WebMethodMethod() { // $JaxWsEndpointRemoteMethod
}
@WebEndpoint
void WebEndpointMethod() { // $JaxWsEndpointRemoteMethod
}
}
@WebServiceProvider
class WebServiceProviderClass { // $JaxWsEndpoint
@WebMethod
void WebMethodMethod() { // $JaxWsEndpointRemoteMethod
}
@WebEndpoint
void WebEndpointMethod() { // $JaxWsEndpointRemoteMethod
}
}
@WebServiceClient
class WebServiceClientClass { // $JaxWsEndpoint
@WebMethod
void WebMethodMethod() { // $JaxWsEndpointRemoteMethod
}
@WebEndpoint
void WebEndpointMethod() { // $JaxWsEndpointRemoteMethod
}
}

View File

@@ -0,0 +1,27 @@
import java
import semmle.code.java.frameworks.JaxWS
import TestUtilities.InlineExpectationsTest
class JaxWsEndpointTest extends InlineExpectationsTest {
JaxWsEndpointTest() { this = "JaxWsEndpointTest" }
override string getARelevantTag() { result = ["JaxWsEndpoint", "JaxWsEndpointRemoteMethod"] }
override predicate hasActualResult(Location location, string element, string tag, string value) {
tag = "JaxWsEndpoint" and
exists(JaxWsEndpoint jaxWsEndpoint |
jaxWsEndpoint.getLocation() = location and
element = jaxWsEndpoint.toString() and
value = ""
)
or
tag = "JaxWsEndpointRemoteMethod" and
exists(Callable remoteMethod |
remoteMethod = any(JaxWsEndpoint jaxWsEndpoint).getARemoteMethod()
|
remoteMethod.getLocation() = location and
element = remoteMethod.toString() and
value = ""
)
}
}

View File

@@ -0,0 +1 @@
//semmle-extractor-options: --javac-args -cp ${testdir}/../../../stubs/jsr311-api-1.1.1:${testdir}/../../../stubs/jsr181-api:${testdir}/../../../stubs/jaxws-api-2.0