aboutsummaryrefslogtreecommitdiffstats
path: root/config
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2021-05-07 19:27:42 +0200
committerHenning Baldersheim <balder@yahoo-inc.com>2021-05-07 19:27:42 +0200
commit3519a6bcf226f01be1cf5c0aa085fb4dd173d47d (patch)
tree604afb97e1420004c9d97bc2dde137560e062fe7 /config
parenta19ae0c3cde262dc4d60bc6254ccdc13532ce569 (diff)
Use ByteBuffer interface.
Diffstat (limited to 'config')
-rw-r--r--config/src/test/java/com/yahoo/vespa/config/protocol/ConfigResponseTest.java17
1 files changed, 8 insertions, 9 deletions
diff --git a/config/src/test/java/com/yahoo/vespa/config/protocol/ConfigResponseTest.java b/config/src/test/java/com/yahoo/vespa/config/protocol/ConfigResponseTest.java
index a56c7ef2daa..c53a6b5c73d 100644
--- a/config/src/test/java/com/yahoo/vespa/config/protocol/ConfigResponseTest.java
+++ b/config/src/test/java/com/yahoo/vespa/config/protocol/ConfigResponseTest.java
@@ -2,6 +2,7 @@
package com.yahoo.vespa.config.protocol;
import com.yahoo.foo.SimpletypesConfig;
+import com.yahoo.text.AbstractUtf8Array;
import com.yahoo.text.Utf8Array;
import com.yahoo.vespa.config.ConfigPayload;
import com.yahoo.vespa.config.LZ4PayloadCompressor;
@@ -11,10 +12,8 @@ import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
-import static org.hamcrest.core.Is.is;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertThat;
/**
* @author Ulf Lilleengen
@@ -29,20 +28,20 @@ public class ConfigResponseTest {
response.serialize(baos, CompressionType.UNCOMPRESSED);
String payload = baos.toString(StandardCharsets.UTF_8);
assertNotNull(payload);
- assertEquals("{\"boolval\":false,\"doubleval\":0.0,\"enumval\":\"VAL1\",\"intval\":0,\"longval\":0,\"stringval\":\"s\"}", payload);
- assertThat(response.getGeneration(), is(3L));
- assertThat(response.getConfigMd5(), is("mymd5"));
+ assertEquals("{\"boolval\":false,\"doubleval\":0.0,\"enumval\":\"VAL1\",\"intval\":0,\"longval\":0,\"stringval\":\"s\"}", payload.toString());
+ assertEquals(response.getGeneration(), 3L);
+ assertEquals(response.getConfigMd5(), "mymd5");
baos = new ByteArrayOutputStream();
response.serialize(baos, CompressionType.UNCOMPRESSED);
- assertThat(baos.toString(), is("{\"boolval\":false,\"doubleval\":0.0,\"enumval\":\"VAL1\",\"intval\":0,\"longval\":0,\"stringval\":\"s\"}"));
+ assertEquals(baos.toString(),"{\"boolval\":false,\"doubleval\":0.0,\"enumval\":\"VAL1\",\"intval\":0,\"longval\":0,\"stringval\":\"s\"}");
}
@Test
public void require_that_slime_response_decompresses_on_serialize() throws IOException {
ConfigPayload configPayload = ConfigPayload.fromInstance(new SimpletypesConfig(new SimpletypesConfig.Builder()));
- Utf8Array data = configPayload.toUtf8Array(true);
- Utf8Array bytes = new Utf8Array(new LZ4PayloadCompressor().compress(data.getBytes()));
+ AbstractUtf8Array data = configPayload.toUtf8Array(true);
+ Utf8Array bytes = new Utf8Array(new LZ4PayloadCompressor().compress(data.wrap()));
ConfigResponse response = new SlimeConfigResponse(bytes, 3, false, "mymd5", CompressionInfo.create(CompressionType.LZ4, data.getByteLength()));
ByteArrayOutputStream baos = new ByteArrayOutputStream();
response.serialize(baos, CompressionType.UNCOMPRESSED);
@@ -51,7 +50,7 @@ public class ConfigResponseTest {
baos = new ByteArrayOutputStream();
response.serialize(baos, CompressionType.UNCOMPRESSED);
- assertThat(baos.toString(), is("{\"boolval\":false,\"doubleval\":0.0,\"enumval\":\"VAL1\",\"intval\":0,\"longval\":0,\"stringval\":\"s\"}"));
+ assertEquals(baos.toString(), "{\"boolval\":false,\"doubleval\":0.0,\"enumval\":\"VAL1\",\"intval\":0,\"longval\":0,\"stringval\":\"s\"}");
}
}