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

cleanup some jetty references #588

Merged
merged 2 commits into from
Oct 2, 2023
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/main/java/emissary/client/EmissaryClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@
import org.apache.hc.client5.http.impl.classic.HttpClientBuilder;
import org.apache.hc.client5.http.impl.io.PoolingHttpClientConnectionManager;
import org.apache.hc.client5.http.protocol.HttpClientContext;
import org.apache.hc.core5.http.HttpStatus;
import org.apache.hc.core5.http.message.BasicClassicHttpResponse;
import org.apache.hc.core5.util.Timeout;
import org.eclipse.jetty.http.HttpStatus;
import org.eclipse.jetty.util.security.Password;
import org.glassfish.jersey.server.filter.CsrfProtectionFilter;
import org.slf4j.Logger;
Expand Down Expand Up @@ -207,7 +207,7 @@ public EmissaryResponse send(final HttpUriRequestBase method, @Nullable final Co
return thisClient.execute(method, localContext, new EmissaryResponseHandler());
} catch (IOException e) {
LOGGER.debug("Problem processing request:", e);
BasicClassicHttpResponse response = new BasicClassicHttpResponse(HttpStatus.INTERNAL_SERVER_ERROR_500, e.getMessage());
BasicClassicHttpResponse response = new BasicClassicHttpResponse(HttpStatus.SC_INTERNAL_SERVER_ERROR, e.getMessage());
response.setEntity(EntityBuilder.create().setText(e.getClass() + ": " + e.getMessage()).setContentEncoding(MediaType.TEXT_PLAIN).build());
return new EmissaryResponse(response);
}
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/emissary/client/EmissaryResponse.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
import org.apache.hc.core5.http.Header;
import org.apache.hc.core5.http.HttpEntity;
import org.apache.hc.core5.http.HttpHeaders;
import org.apache.hc.core5.http.HttpStatus;
import org.apache.hc.core5.http.io.HttpClientResponseHandler;
import org.apache.hc.core5.http.io.entity.EntityUtils;
import org.eclipse.jetty.http.HttpStatus;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand Down Expand Up @@ -77,7 +77,7 @@ public String getContentString() {
return null;
}
try {
if (status == HttpStatus.OK_200) {
if (status == HttpStatus.SC_OK) {
return content.toString();
} else {
return "Bad request -> status: " + status + " message: " + content;
Expand All @@ -94,7 +94,7 @@ public <T extends BaseEntity> T getContent(Class<T> mapper) {
return null;
}
try {
if (status == HttpStatus.OK_200) {
if (status == HttpStatus.SC_OK) {
return objectMapper.readValue(content.toString(), mapper);
} else {
return makeErrorEntity(content.toString(), mapper);
Expand Down
15 changes: 1 addition & 14 deletions src/test/java/emissary/test/core/junit5/FunctionalTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -62,17 +62,9 @@ protected IDirectoryPlace startDirectory(int port) {
}

/**
* Start a localhost jetty on the specified port using jetty.xml in the local package
* Start a localhost jetty on the specified port. Create a emissary/test123 user in a /tmp/jetty-users.properties
*/
protected void startJetty(int port) throws Exception {
startJetty(port, "jetty");
}

/**
* Start a localhost jetty on the specified port Create a emissary/test123 user in a /tmp/jetty-users.properties but use
* the runtime package "xrez".xml file
*/
protected void startJetty(int port, String xrez) throws Exception {
String PROJECT_BASE = System.getenv(ConfigUtil.PROJECT_BASE_ENV);
// Set up a password file
File realmFile = new File(PROJECT_BASE + "/config", "jetty-users.properties");
Expand All @@ -81,11 +73,6 @@ protected void startJetty(int port, String xrez) throws Exception {
}

String nodeName = "localhost";
// System.setProperty(EmissaryNode.NODE_NAME_PROPERTY, nodeName);
// System.setProperty(EmissaryNode.NODE_PORT_PROPERTY, "" + port);
// ResourceReader rr = new ResourceReader();
// String xmlName = rr.getXmlName(thisPackage, xrez);
// Resource jettyxml = Resource.newSystemResource(xmlName);
String[] args = new String[] {"-b", PROJECT_BASE, "-p", Integer.toString(port), "-h", nodeName, "--mobileAgents", Integer.toString(3)};
try {
ServerCommand cmd = ServerCommand.parse(ServerCommand.class, args);
Expand Down