Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple code improvements - squid:S1192, squid:S1488, squid:S1213 #154

Merged
merged 1 commit into from Sep 5, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -47,6 +47,9 @@
public class TestRunResource {

private static final Logger LOGR = Logger.getLogger(TestRunResource.class.getPackage().getName());
public static final String TEST_RUN_ARGUMENTS = "Test run arguments - ";
public static final String ENTITY_MEDIA_TYPE = "Entity media type: ";
public static final String FILE_LOCATION = "File location: ";
@Context
private UriInfo reqUriInfo;

Expand All @@ -68,13 +71,12 @@ public class TestRunResource {
public Source handleGet(@PathParam("etsCode") String etsCode, @PathParam("etsVersion") String etsVersion) {
MultivaluedMap<String, String> params = this.reqUriInfo.getQueryParameters();
if (LOGR.isLoggable(Level.FINE)) {
StringBuilder msg = new StringBuilder("Test run arguments - ");
StringBuilder msg = new StringBuilder(TEST_RUN_ARGUMENTS);
msg.append(etsCode).append("/").append(etsVersion).append("\n");
msg.append(params.toString());
LOGR.fine(msg.toString());
}
Source results = executeTestRun(etsCode, etsVersion, params);
return results;
return executeTestRun(etsCode, etsVersion, params);
}

/**
Expand All @@ -99,16 +101,15 @@ public Source handlePost(@PathParam("etsCode") String etsCode, @PathParam("etsVe
throw new WebApplicationException(400);
}
if (LOGR.isLoggable(Level.FINE)) {
StringBuilder msg = new StringBuilder("Test run arguments - ");
StringBuilder msg = new StringBuilder(TEST_RUN_ARGUMENTS);
msg.append(etsCode).append("/").append(etsVersion).append("\n");
msg.append("Entity media type: " + this.headers.getMediaType());
msg.append("File location: " + entityBody.getAbsolutePath());
msg.append(ENTITY_MEDIA_TYPE + this.headers.getMediaType());
msg.append(FILE_LOCATION + entityBody.getAbsolutePath());
LOGR.fine(msg.toString());
}
Map<String, java.util.List<String>> args = new HashMap<String, List<String>>();
args.put("iut", Arrays.asList(entityBody.toURI().toString()));
Source results = executeTestRun(etsCode, etsVersion, args);
return results;
return executeTestRun(etsCode, etsVersion, args);
}

/**
Expand Down Expand Up @@ -150,10 +151,10 @@ public Source handleMultipartFormData(@PathParam("etsCode") String etsCode,
throw new WebApplicationException(400);
}
if (LOGR.isLoggable(Level.FINE)) {
StringBuilder msg = new StringBuilder("Test run arguments - ");
StringBuilder msg = new StringBuilder(TEST_RUN_ARGUMENTS);
msg.append(etsCode).append("/").append(etsVersion).append("\n");
msg.append("Entity media type: " + this.headers.getMediaType());
msg.append("File location: " + entityBody.getAbsolutePath());
msg.append(ENTITY_MEDIA_TYPE + this.headers.getMediaType());
msg.append(FILE_LOCATION + entityBody.getAbsolutePath());
LOGR.fine(msg.toString());
}
args.put("iut", Arrays.asList(entityBody.toURI().toString()));
Expand All @@ -162,16 +163,15 @@ public Source handleMultipartFormData(@PathParam("etsCode") String etsCode,
throw new WebApplicationException(400);
}
if (LOGR.isLoggable(Level.FINE)) {
StringBuilder msg = new StringBuilder("Test run arguments - ");
StringBuilder msg = new StringBuilder(TEST_RUN_ARGUMENTS);
msg.append(etsCode).append("/").append(etsVersion).append("\n");
msg.append("Entity media type: " + this.headers.getMediaType());
msg.append("File location: " + schBody.getAbsolutePath());
msg.append(ENTITY_MEDIA_TYPE + this.headers.getMediaType());
msg.append(FILE_LOCATION + schBody.getAbsolutePath());
LOGR.fine(msg.toString());
}
args.put("sch", Arrays.asList(schBody.toURI().toString()));
}
Source results = executeTestRun(etsCode, etsVersion, args);
return results;
return executeTestRun(etsCode, etsVersion, args);
}

/**
Expand Down
Expand Up @@ -63,24 +63,13 @@ public class CoverageMonitor {
.getPackage().getName());
private static final Map<URI, String> ICS_MAP = createICSMap();

private static Map<URI, String> createICSMap() {
HashMap<URI, String> icsMap = new HashMap<URI, String>();
icsMap.put(URI.create("urn:wms_client_test_suite/GetCapabilities"),
"WMS-GetCapabilities.xml");
icsMap.put(URI.create("urn:wms_client_test_suite/GetMap"),
"WMS-GetMap.xml");
icsMap.put(URI.create("urn:wms_client_test_suite/GetFeatureInfo"),
"WMS-GetFeatureInfo.xml");
return icsMap;
}

private URI requestId;
private Document coverageDoc;
private File testSessionDir;

/**
* Creates a CoverageMonitor for a given service request.
*
*
* @param uri
* A URI value that identifies a service request message.
*/
Expand All @@ -98,6 +87,17 @@ public CoverageMonitor(String uri) {
LOGR.config("Created coverage monitor using ICS at " + icsPath);
}

private static Map<URI, String> createICSMap() {
HashMap<URI, String> icsMap = new HashMap<URI, String>();
icsMap.put(URI.create("urn:wms_client_test_suite/GetCapabilities"),
"WMS-GetCapabilities.xml");
icsMap.put(URI.create("urn:wms_client_test_suite/GetMap"),
"WMS-GetMap.xml");
icsMap.put(URI.create("urn:wms_client_test_suite/GetFeatureInfo"),
"WMS-GetFeatureInfo.xml");
return icsMap;
}

/**
* Returns the location of the test session directory.
*
Expand Down