|
@@ -12,7 +12,6 @@ import java.util.concurrent.ThreadLocalRandom;
|
|
|
import com.fasterxml.jackson.core.JsonGenerator;
|
|
|
import com.fasterxml.jackson.databind.*;
|
|
|
import com.fasterxml.jackson.databind.jsontype.TypeSerializer;
|
|
|
-import com.fasterxml.jackson.module.afterburner.AfterburnerModule;
|
|
|
|
|
|
/**
|
|
|
* Some common functionality and constants used by the Servlet tests.
|
|
@@ -27,8 +26,6 @@ public class Common {
|
|
|
|
|
|
// Jackson encoder, reused for each response.
|
|
|
protected static final ObjectMapper MAPPER = new ObjectMapper();
|
|
|
- // Jackson encoder with AfterBurner module
|
|
|
- protected static final ObjectMapper AF_MAPPER = new ObjectMapper().registerModule(new AfterburnerModule());
|
|
|
|
|
|
private static final String DB_QUERY = "SELECT * FROM world";
|
|
|
|
|
@@ -37,24 +34,6 @@ public class Common {
|
|
|
public final String message = "Hello, World!";
|
|
|
}
|
|
|
|
|
|
- // Response message class with custom Jackson serializer
|
|
|
- public static class HelloMessageCJS implements JsonSerializable {
|
|
|
- public final String message = "Hello, World!";
|
|
|
-
|
|
|
- @Override
|
|
|
- public void serialize(JsonGenerator jg, SerializerProvider sp) throws IOException {
|
|
|
- jg.writeStartObject();
|
|
|
- jg.writeStringField("message", this.message);
|
|
|
- jg.writeEndObject();
|
|
|
- }
|
|
|
-
|
|
|
- @Override
|
|
|
- public void serializeWithType(JsonGenerator jg, SerializerProvider sp,
|
|
|
- TypeSerializer ts) throws IOException {
|
|
|
- throw new UnsupportedOperationException("Not needed so far.");
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
// Request parameter checking and normalisation
|
|
|
public static int normalise(String param) {
|
|
|
int count = 1;
|
|
@@ -95,4 +74,4 @@ public class Common {
|
|
|
public static int getRandom() {
|
|
|
return 1 + ThreadLocalRandom.current().nextInt(DB_ROWS);
|
|
|
}
|
|
|
-}
|
|
|
+}
|