Skip to content

Commit

Permalink
Fix PMD violations
Browse files Browse the repository at this point in the history
  • Loading branch information
reta committed Mar 1, 2025
1 parent 2aa4cfc commit 6e66192
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import org.apache.cxf.service.model.ServiceInfo;
import org.omg.CORBA.ORB;

@SuppressWarnings("PMD.FinalFieldCouldBeStatic")
public abstract class AbstractStartEndEventProducer implements
CorbaTypeEventProducer {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import javax.xml.stream.events.Attribute;
import javax.xml.stream.events.Namespace;

@SuppressWarnings("PMD.FinalFieldCouldBeStatic")
public class CorbaOctetSequenceEventProducer implements CorbaTypeEventProducer {

int state;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ public void testServiceUnavailable() throws Exception {

exception.expect(WebServiceException.class);
exception.expectCause(new TypeSafeMatcher<Throwable>() {
private final String message = "HTTP response '503: Service Unavailable' when "
private static final String message = "HTTP response '503: Service Unavailable' when "
+ "communicating with http://localhost:" + BadServer.PORT + "/Mortimer";

@Override
Expand All @@ -109,7 +109,7 @@ public void testNotFound() throws Exception {

exception.expect(WebServiceException.class);
exception.expectCause(new TypeSafeMatcher<Throwable>() {
private final String message = "HTTP response '404: Not Found' when "
private static final String message = "HTTP response '404: Not Found' when "
+ "communicating with http://localhost:" + BadServer.PORT + "/Mortimer";

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,10 @@

public class NoSpringServletClientTest extends AbstractServletTest {
private static final String PORT = NoSpringServletServer.PORT;
private static final String SERVICE_URL = "http://localhost:" + PORT + "/soap/";
private static Bus serverBus;
private static NoSpringServletServer server;
private final QName portName = new QName("http://apache.org/hello_world_soap_http", "SoapPort");
private final String serviceURL = "http://localhost:" + PORT + "/soap/";

@BeforeClass
public static void startServers() throws Exception {
Expand All @@ -73,7 +73,7 @@ public static void shutdownServer() throws Exception {

@Test
public void testBasicConnection() throws Exception {
SOAPService service = new SOAPService(new URL(serviceURL + "Greeter?wsdl"));
SOAPService service = new SOAPService(new URL(SERVICE_URL + "Greeter?wsdl"));
Greeter greeter = service.getPort(portName, Greeter.class);
try {
String reply = greeter.greetMe("test");
Expand All @@ -90,7 +90,7 @@ public void testBasicConnection() throws Exception {
@Test
public void testHelloService() throws Exception {
JaxWsProxyFactoryBean cpfb = new JaxWsProxyFactoryBean();
String address = serviceURL + "Hello";
String address = SERVICE_URL + "Hello";
cpfb.setServiceClass(Hello.class);
cpfb.setAddress(address);
Hello hello = (Hello) cpfb.create();
Expand Down Expand Up @@ -133,7 +133,7 @@ private void startServer() {
@Test
public void testGetServiceList() throws Exception {
try (CloseableHttpClient client = HttpClients.createDefault()) {
final HttpGet method = new HttpGet(serviceURL + "/services");
final HttpGet method = new HttpGet(SERVICE_URL + "/services");

try (CloseableHttpResponse res = client.execute(method)) {
HTMLDocumentImpl doc = parse(res.getEntity().getContent());
Expand All @@ -144,9 +144,9 @@ public void testGetServiceList() throws Exception {
s.add(l.getHref());
}
assertEquals("There should be 3 links for the service", 3, links.size());
assertTrue(s.contains(serviceURL + "Greeter?wsdl"));
assertTrue(s.contains(serviceURL + "Hello?wsdl"));
assertTrue(s.contains(serviceURL + "?wsdl"));
assertTrue(s.contains(SERVICE_URL + "Greeter?wsdl"));
assertTrue(s.contains(SERVICE_URL + "Hello?wsdl"));
assertTrue(s.contains(SERVICE_URL + "?wsdl"));
assertEquals("text/html", getContentType(res));
}
}
Expand Down

0 comments on commit 6e66192

Please sign in to comment.