aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2018-05-18 10:58:10 +0300
committerGravatar Vitaly Takmazov2018-05-18 10:58:10 +0300
commit1179cdc5ba750c87783e442afeb202026ddd458d (patch)
tree9d033a111c8153dbcb7c70b0def7e3c6e1f0079f
parent1f9ee1cb9d3c199ec6f1d87f814504295c60959b (diff)
drop org.json dependency
-rw-r--r--juick-common/build.gradle2
-rw-r--r--juick-server/src/test/java/com/juick/server/tests/ServerTests.java15
2 files changed, 4 insertions, 13 deletions
diff --git a/juick-common/build.gradle b/juick-common/build.gradle
index bb21aee7..c57655f1 100644
--- a/juick-common/build.gradle
+++ b/juick-common/build.gradle
@@ -5,7 +5,6 @@ dependencies {
compile("org.springframework.boot:spring-boot-starter-security")
compile("org.springframework.boot:spring-boot-starter-web")
compile("org.springframework.boot:spring-boot-starter-websocket")
- compile("org.springframework.boot:spring-boot-starter-json")
compile "org.apache.commons:commons-lang3:3.7"
compile "org.apache.commons:commons-collections4:4.1"
compile 'org.apache.commons:commons-text:1.3'
@@ -21,5 +20,4 @@ dependencies {
compile "javax.xml.bind:jaxb-api:2.3.0"
compile 'org.glassfish.jaxb:jaxb-runtime:2.3.0'
testCompile("org.springframework.boot:spring-boot-starter-test")
- testCompile "org.json:json:20180130"
}
diff --git a/juick-server/src/test/java/com/juick/server/tests/ServerTests.java b/juick-server/src/test/java/com/juick/server/tests/ServerTests.java
index 840bebbb..9a78b0a2 100644
--- a/juick-server/src/test/java/com/juick/server/tests/ServerTests.java
+++ b/juick-server/src/test/java/com/juick/server/tests/ServerTests.java
@@ -19,8 +19,7 @@ package com.juick.server.tests;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
-import com.fasterxml.jackson.datatype.jdk8.Jdk8Module;
-import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
+import com.jayway.jsonpath.JsonPath;
import com.juick.*;
import com.juick.server.*;
import com.juick.server.component.MessageEvent;
@@ -35,8 +34,6 @@ import com.juick.util.MessageUtils;
import org.apache.commons.codec.CharEncoding;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.StringUtils;
-import org.json.JSONException;
-import org.json.JSONObject;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
@@ -967,7 +964,7 @@ public class ServerTests {
}
@Test
public void messageParserSerializer() throws ParserConfigurationException,
- IOException, SAXException, JAXBException, JSONException {
+ IOException, SAXException, JAXBException {
Message msg = new Message();
msg.setTags(MessageUtils.parseTags("test test" + (char) 0xA0 + "2 test3"));
assertEquals("First tag must be", "test", msg.getTags().get(0).getName());
@@ -975,13 +972,9 @@ public class ServerTests {
assertEquals("Count of tags must be", 3, msg.getTags().size());
Instant currentDate = Instant.now();
msg.setTimestamp(currentDate);
- ObjectMapper serializer = new ObjectMapper();
- serializer.registerModule(new Jdk8Module());
- serializer.registerModule(new JavaTimeModule());
- String jsonMessage = serializer.writeValueAsString(msg);
- JSONObject jsonObject = new JSONObject(jsonMessage);
+ String jsonMessage = jsonMapper.writeValueAsString(msg);
assertEquals("date should be in timestamp field", DateFormattersHolder.getMessageFormatterInstance().format(currentDate),
- jsonObject.getString("timestamp"));
+ JsonPath.read(jsonMessage, "$.timestamp"));
JAXBContext context = JAXBContext